Mercurial > pidgin.yaz
annotate pidgin/gtkmedia.c @ 26176:08a3749993fe
Remove unnecessary buttons and change statusbar to say "Calling..."
initially instead of "Connecting...".
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Thu, 05 Feb 2009 08:32:54 +0000 |
parents | cc96a5ec4782 |
children | 8b95080061ed |
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" | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
31 #include "mediamanager.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
|
32 #include "pidgin.h" |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
33 #include "request.h" |
25550 | 34 |
35 #include "gtkmedia.h" | |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
36 #include "gtkutils.h" |
25550 | 37 |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
38 #ifdef USE_VV |
25550 | 39 |
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
|
40 #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
|
41 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
42 typedef enum |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
43 { |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
44 /* Waiting for response */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
45 PIDGIN_MEDIA_WAITING = 1, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
46 /* Got request */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
47 PIDGIN_MEDIA_REQUESTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
48 /* Accepted call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
49 PIDGIN_MEDIA_ACCEPTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
50 /* Rejected call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
51 PIDGIN_MEDIA_REJECTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
52 } PidginMediaState; |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
53 |
25550 | 54 struct _PidginMediaPrivate |
55 { | |
56 PurpleMedia *media; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
57 gchar *screenname; |
25550 | 58 GstElement *send_level; |
59 GstElement *recv_level; | |
60 | |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
61 GtkWidget *menubar; |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
62 GtkWidget *statusbar; |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
63 |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
64 GtkWidget *mute; |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
65 |
25550 | 66 GtkWidget *send_progress; |
67 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
|
68 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
69 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
|
70 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
71 GtkWidget *display; |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
72 GtkWidget *send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
73 GtkWidget *recv_widget; |
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
|
74 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
|
75 GtkWidget *remote_video; |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
76 PurpleConnection *pc; |
25550 | 77 }; |
78 | |
79 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
80 | |
81 static void pidgin_media_class_init (PidginMediaClass *klass); | |
82 static void pidgin_media_init (PidginMedia *media); | |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
83 static void pidgin_media_dispose (GObject *object); |
25550 | 84 static void pidgin_media_finalize (GObject *object); |
85 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
86 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
|
87 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
25550 | 88 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
89 static GtkWindowClass *parent_class = NULL; |
25550 | 90 |
91 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
92 #if 0 |
25550 | 93 enum { |
94 LAST_SIGNAL | |
95 }; | |
96 static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
97 #endif |
25550 | 98 |
99 enum { | |
100 PROP_0, | |
101 PROP_MEDIA, | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
102 PROP_SCREENNAME, |
25550 | 103 PROP_SEND_LEVEL, |
104 PROP_RECV_LEVEL | |
105 }; | |
106 | |
107 GType | |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
108 pidgin_media_get_type(void) |
25550 | 109 { |
110 static GType type = 0; | |
111 | |
112 if (type == 0) { | |
113 static const GTypeInfo info = { | |
114 sizeof(PidginMediaClass), | |
115 NULL, | |
116 NULL, | |
117 (GClassInitFunc) pidgin_media_class_init, | |
118 NULL, | |
119 NULL, | |
120 sizeof(PidginMedia), | |
121 0, | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
122 (GInstanceInitFunc) pidgin_media_init, |
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
123 NULL |
25550 | 124 }; |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
125 type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0); |
25550 | 126 } |
127 return type; | |
128 } | |
129 | |
130 | |
131 static void | |
132 pidgin_media_class_init (PidginMediaClass *klass) | |
133 { | |
134 GObjectClass *gobject_class = (GObjectClass*)klass; | |
25679 | 135 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
25550 | 136 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
|
137 |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
138 gobject_class->dispose = pidgin_media_dispose; |
25550 | 139 gobject_class->finalize = pidgin_media_finalize; |
140 gobject_class->set_property = pidgin_media_set_property; | |
141 gobject_class->get_property = pidgin_media_get_property; | |
142 | |
143 g_object_class_install_property(gobject_class, PROP_MEDIA, | |
144 g_param_spec_object("media", | |
145 "PurpleMedia", | |
146 "The PurpleMedia associated with this media.", | |
147 PURPLE_TYPE_MEDIA, | |
148 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
149 g_object_class_install_property(gobject_class, PROP_SCREENNAME, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
150 g_param_spec_string("screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
151 "Screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
152 "The screenname of the user this session is with.", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
153 NULL, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
154 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
25550 | 155 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL, |
156 g_param_spec_object("send-level", | |
157 "Send level", | |
158 "The GstElement of this media's send 'level'", | |
159 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
|
160 G_PARAM_READWRITE)); |
25550 | 161 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL, |
162 g_param_spec_object("recv-level", | |
163 "Receive level", | |
164 "The GstElement of this media's recv 'level'", | |
165 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
|
166 G_PARAM_READWRITE)); |
25550 | 167 |
168 g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
169 } | |
170 | |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
171 static void |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
172 pidgin_media_mute_toggled(GtkToggleButton *toggle, PidginMedia *media) |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
173 { |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
174 purple_media_mute(media->priv->media, |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
175 gtk_toggle_button_get_active(toggle)); |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
176 } |
25550 | 177 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
178 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
179 pidgin_media_delete_event_cb(GtkWidget *widget, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
180 GdkEvent *event, PidginMedia *media) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
181 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
182 if (media->priv->media) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
183 purple_media_hangup(media->priv->media); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
184 return FALSE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
185 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
186 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
187 static int |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
188 pidgin_x_error_handler(Display *display, XErrorEvent *event) |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
189 { |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
190 const gchar *error_type; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
191 switch (event->error_code) { |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
192 #define XERRORCASE(type) case type: error_type = #type; break |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
193 XERRORCASE(BadAccess); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
194 XERRORCASE(BadAlloc); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
195 XERRORCASE(BadAtom); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
196 XERRORCASE(BadColor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
197 XERRORCASE(BadCursor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
198 XERRORCASE(BadDrawable); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
199 XERRORCASE(BadFont); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
200 XERRORCASE(BadGC); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
201 XERRORCASE(BadIDChoice); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
202 XERRORCASE(BadImplementation); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
203 XERRORCASE(BadLength); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
204 XERRORCASE(BadMatch); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
205 XERRORCASE(BadName); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
206 XERRORCASE(BadPixmap); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
207 XERRORCASE(BadRequest); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
208 XERRORCASE(BadValue); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
209 XERRORCASE(BadWindow); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
210 #undef XERRORCASE |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
211 default: |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
212 error_type = "unknown"; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
213 break; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
214 } |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
215 purple_debug_error("media", "A %s Xlib error has occurred. " |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
216 "The program would normally crash now.\n", |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
217 error_type); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
218 return 0; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
219 } |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
220 |
25550 | 221 static void |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
222 menu_hangup(gpointer data, guint action, GtkWidget *item) |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
223 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
224 PidginMedia *gtkmedia = PIDGIN_MEDIA(data); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
225 purple_media_hangup(gtkmedia->priv->media); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
226 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
227 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
228 static GtkItemFactoryEntry menu_items[] = { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
229 { N_("/_Media"), NULL, NULL, 0, "<Branch>", NULL }, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
230 { N_("/Media/_Hangup"), NULL, menu_hangup, 0, "<Item>", NULL }, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
231 }; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
232 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
233 static gint menu_item_count = sizeof(menu_items) / sizeof(menu_items[0]); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
234 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
235 static const char * |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
236 item_factory_translate_func (const char *path, gpointer func_data) |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
237 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
238 return _(path); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
239 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
240 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
241 static GtkWidget * |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
242 setup_menubar(PidginMedia *window) |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
243 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
244 GtkItemFactory *item_factory; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
245 GtkAccelGroup *accel_group; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
246 GtkWidget *menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
247 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
248 accel_group = gtk_accel_group_new (); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
249 gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
250 g_object_unref(accel_group); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
251 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
252 item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
253 "<main>", accel_group); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
254 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
255 gtk_item_factory_set_translate_func(item_factory, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
256 (GtkTranslateFunc)item_factory_translate_func, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
257 NULL, NULL); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
258 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
259 gtk_item_factory_create_items(item_factory, menu_item_count, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
260 menu_items, window); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
261 g_signal_connect(G_OBJECT(accel_group), "accel-changed", |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
262 G_CALLBACK(pidgin_save_accels_cb), NULL); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
263 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
264 menu = gtk_item_factory_get_widget(item_factory, "<main>"); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
265 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
266 gtk_widget_show(menu); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
267 return menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
268 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
269 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
270 static void |
25550 | 271 pidgin_media_init (PidginMedia *media) |
272 { | |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
273 GtkWidget *vbox, *hbox; |
25550 | 274 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
275 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
276 XSetErrorHandler(pidgin_x_error_handler); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
277 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
278 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
279 gtk_container_add(GTK_CONTAINER(media), vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
280 |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
281 media->priv->statusbar = gtk_statusbar_new(); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
282 gtk_box_pack_end(GTK_BOX(vbox), media->priv->statusbar, |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
283 FALSE, FALSE, 0); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
284 gtk_statusbar_push(GTK_STATUSBAR(media->priv->statusbar), |
26176
08a3749993fe
Remove unnecessary buttons and change statusbar to say "Calling..."
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
285 0, _("Calling...")); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
286 gtk_widget_show(media->priv->statusbar); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
287 |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
288 media->priv->menubar = setup_menubar(media); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
289 gtk_box_pack_start(GTK_BOX(vbox), media->priv->menubar, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
290 FALSE, TRUE, 0); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
291 |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
292 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
293 gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
294 gtk_widget_show(GTK_WIDGET(hbox)); |
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
295 |
26034
6260a6192166
Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26027
diff
changeset
|
296 media->priv->mute = gtk_toggle_button_new_with_mnemonic("_Mute"); |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
297 |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
298 g_signal_connect(media->priv->mute, "toggled", |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
299 G_CALLBACK(pidgin_media_mute_toggled), media); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
300 |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
301 gtk_box_pack_end(GTK_BOX(hbox), media->priv->mute, FALSE, FALSE, 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
|
302 |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
303 media->priv->display = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
304 gtk_box_pack_start(GTK_BOX(vbox), media->priv->display, |
26131
6eeb500ce9a2
Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26130
diff
changeset
|
305 TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
306 gtk_widget_show(vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
307 |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
308 g_signal_connect(G_OBJECT(media), "delete-event", |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
309 G_CALLBACK(pidgin_media_delete_event_cb), media); |
25550 | 310 } |
311 | |
312 static gboolean | |
313 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) | |
314 { | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
315 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
|
316 gdouble percent; |
25550 | 317 const GValue *list; |
318 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
|
319 |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
320 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(message)); |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
321 GtkWidget *progress; |
25550 | 322 |
323 if (message->type != GST_MESSAGE_ELEMENT) | |
324 return TRUE; | |
325 | |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
326 if (gst_structure_has_name( |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
327 gst_message_get_structure(message), "level")) |
25550 | 328 return TRUE; |
329 | |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
330 if (src == gtkmedia->priv->send_level) |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
331 progress = gtkmedia->priv->send_progress; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
332 else if (src == gtkmedia->priv->recv_level) |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
333 progress = gtkmedia->priv->recv_progress; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
334 else |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
335 return TRUE; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
336 |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
337 list = gst_structure_get_value( |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
338 gst_message_get_structure(message), "rms"); |
25550 | 339 |
340 /* Only bother with the first channel. */ | |
341 value = gst_value_list_get_value(list, 0); | |
342 rms_db = g_value_get_double(value); | |
343 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
344 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
|
345 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
346 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
|
347 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
|
348 |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
349 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), percent); |
25550 | 350 return TRUE; |
351 } | |
352 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
353 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
354 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
|
355 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
|
356 { |
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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 if (handler_id) |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
362 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
|
363 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
|
364 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
365 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
366 static void |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
367 pidgin_media_dispose(GObject *media) |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
368 { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
369 PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
370 purple_debug_info("gtkmedia", "pidgin_media_dispose\n"); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
371 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
372 if (gtkmedia->priv->media) { |
26157
1aed9a92b657
Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
373 purple_media_remove_output_windows(gtkmedia->priv->media); |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
374 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
375 g_object_unref(gtkmedia->priv->media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
376 gtkmedia->priv->media = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
377 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
378 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
379 if (gtkmedia->priv->send_level) { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
380 gst_object_unref(gtkmedia->priv->send_level); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
381 gtkmedia->priv->send_level = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
382 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
383 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
384 if (gtkmedia->priv->recv_level) { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
385 gst_object_unref(gtkmedia->priv->recv_level); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
386 gtkmedia->priv->recv_level = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
387 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
388 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
389 G_OBJECT_CLASS(parent_class)->dispose(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
390 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
391 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
392 static void |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
393 pidgin_media_finalize(GObject *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
|
394 { |
26131
6eeb500ce9a2
Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26130
diff
changeset
|
395 /* PidginMedia *gtkmedia = PIDGIN_MEDIA(media); */ |
26014
bd598b606ca4
Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26013
diff
changeset
|
396 purple_debug_info("gtkmedia", "pidgin_media_finalize\n"); |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
397 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
398 G_OBJECT_CLASS(parent_class)->finalize(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
|
399 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
400 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
401 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
|
402 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
|
403 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
404 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
405 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
406 purple_connection_get_account(gtkmedia->priv->pc)); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
407 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
408 purple_conversation_write(conv, NULL, msg, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
409 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
410 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
411 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
412 typedef struct |
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
|
413 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
414 PidginMedia *gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
415 gchar *session_id; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
416 gchar *participant; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
417 } PidginMediaRealizeData; |
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
|
418 |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
419 static gboolean |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
420 realize_cb_cb(PidginMediaRealizeData *data) |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
421 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
422 PidginMediaPrivate *priv = data->gtkmedia->priv; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
423 gulong window_id; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
424 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
425 if (data->participant == NULL) |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
426 window_id = GDK_WINDOW_XWINDOW(priv->local_video->window); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
427 else |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
428 window_id = GDK_WINDOW_XWINDOW(priv->remote_video->window); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
429 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
430 purple_media_set_output_window(priv->media, data->session_id, |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
431 data->participant, window_id); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
432 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
433 g_free(data->session_id); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
434 g_free(data->participant); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
435 g_free(data); |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
436 return FALSE; |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
437 } |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
438 |
25550 | 439 static void |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
440 realize_cb(GtkWidget *widget, PidginMediaRealizeData *data) |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
441 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
442 g_timeout_add(0, (GSourceFunc)realize_cb_cb, data); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
443 } |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
444 |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
445 static void |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
446 pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia) |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
447 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
448 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
449 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
450 purple_connection_get_account(gtkmedia->priv->pc)); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
451 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
452 purple_conversation_write(conv, NULL, error, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
453 PURPLE_MESSAGE_ERROR, time(NULL)); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
454 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
455 0, error); |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
456 } |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
457 |
26143
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
458 static void |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
459 pidgin_media_accepted_cb(PurpleMedia *media, const gchar *session_id, |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
460 const gchar *participant, PidginMedia *gtkmedia) |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
461 { |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
462 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED); |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
463 pidgin_media_emit_message(gtkmedia, _("Call in progress.")); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
464 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar), |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
465 0, _("Call in progress.")); |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
466 gtk_widget_show(GTK_WIDGET(gtkmedia)); |
26143
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
467 } |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
468 |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
469 static gboolean |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
470 plug_delete_event_cb(GtkWidget *widget, gpointer data) |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
471 { |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
472 return TRUE; |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
473 } |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
474 |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
475 static gboolean |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
476 plug_removed_cb(GtkWidget *widget, gpointer data) |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
477 { |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
478 return TRUE; |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
479 } |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
480 |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
481 static void |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
482 socket_realize_cb(GtkWidget *widget, gpointer data) |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
483 { |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
484 gtk_socket_add_id(GTK_SOCKET(widget), |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
485 gtk_plug_get_id(GTK_PLUG(data))); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
486 } |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
487 |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
488 static void |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
489 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) |
25550 | 490 { |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
491 GstElement *pipeline = purple_media_get_pipeline(media); |
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
492 GtkWidget *send_widget = NULL, *recv_widget = NULL; |
26117
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
493 gboolean is_initiator; |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
494 PurpleMediaSessionType type = |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
495 purple_media_get_session_type(media, sid); |
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
|
496 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
497 if (gtkmedia->priv->recv_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
498 && type & (PURPLE_MEDIA_RECV_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
499 PURPLE_MEDIA_RECV_AUDIO)) { |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
500 recv_widget = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
501 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:
25720
diff
changeset
|
502 recv_widget, TRUE, TRUE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
503 gtk_widget_show(recv_widget); |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
504 } else |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
505 recv_widget = gtkmedia->priv->recv_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
506 if (gtkmedia->priv->send_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
507 && type & (PURPLE_MEDIA_SEND_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
508 PURPLE_MEDIA_SEND_AUDIO)) { |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
509 send_widget = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
510 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:
25720
diff
changeset
|
511 send_widget, TRUE, TRUE, 0); |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
512 gtk_widget_show(send_widget); |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
513 } else |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
514 send_widget = gtkmedia->priv->send_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
|
515 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
516 if (type & PURPLE_MEDIA_RECV_VIDEO) { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
517 PidginMediaRealizeData *data; |
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
|
518 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
|
519 GtkWidget *remote_video; |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
520 GtkWidget *plug; |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
521 GtkWidget *socket; |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
522 GdkColor color = {0, 0, 0, 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
|
523 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
524 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
|
525 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
|
526 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
|
527 |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
528 plug = gtk_plug_new(0); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
529 g_signal_connect(G_OBJECT(plug), "delete-event", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
530 G_CALLBACK(plug_delete_event_cb), plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
531 gtk_widget_show(plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
532 |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
533 socket = gtk_socket_new(); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
534 g_signal_connect(G_OBJECT(socket), "realize", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
535 G_CALLBACK(socket_realize_cb), plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
536 g_signal_connect(G_OBJECT(socket), "plug-removed", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
537 G_CALLBACK(plug_removed_cb), NULL); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
538 gtk_container_add(GTK_CONTAINER(aspect), socket); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
539 gtk_widget_show(socket); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
540 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
541 data = g_new0(PidginMediaRealizeData, 1); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
542 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
543 data->session_id = g_strdup(sid); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
544 data->participant = g_strdup(gtkmedia->priv->screenname); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
545 |
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
|
546 remote_video = gtk_drawing_area_new(); |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
547 gtk_widget_modify_bg(remote_video, GTK_STATE_NORMAL, &color); |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
548 g_signal_connect(G_OBJECT(remote_video), "realize", |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
549 G_CALLBACK(realize_cb), data); |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
550 gtk_container_add(GTK_CONTAINER(plug), remote_video); |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
551 gtk_widget_set_size_request (GTK_WIDGET(remote_video), 320, 240); |
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
|
552 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
|
553 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
|
554 |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
555 gtkmedia->priv->remote_video = remote_video; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
556 } |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
557 if (type & PURPLE_MEDIA_SEND_VIDEO) { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
558 PidginMediaRealizeData *data; |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
559 GtkWidget *aspect; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
560 GtkWidget *local_video; |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
561 GtkWidget *plug; |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
562 GtkWidget *socket; |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
563 GdkColor color = {0, 0, 0, 0}; |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
564 |
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
|
565 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
|
566 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
|
567 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
|
568 |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
569 plug = gtk_plug_new(0); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
570 g_signal_connect(G_OBJECT(plug), "delete-event", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
571 G_CALLBACK(plug_delete_event_cb), plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
572 gtk_widget_show(plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
573 |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
574 socket = gtk_socket_new(); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
575 g_signal_connect(G_OBJECT(socket), "realize", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
576 G_CALLBACK(socket_realize_cb), plug); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
577 g_signal_connect(G_OBJECT(socket), "plug-removed", |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
578 G_CALLBACK(plug_removed_cb), NULL); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
579 gtk_container_add(GTK_CONTAINER(aspect), socket); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
580 gtk_widget_show(socket); |
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
581 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
582 data = g_new0(PidginMediaRealizeData, 1); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
583 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
584 data->session_id = g_strdup(sid); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
585 data->participant = NULL; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
586 |
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
|
587 local_video = gtk_drawing_area_new(); |
26158
bb8d4ff8276a
Make the backgrounds of the drawing areas black so it doesn't look as
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26157
diff
changeset
|
588 gtk_widget_modify_bg(local_video, GTK_STATE_NORMAL, &color); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
589 g_signal_connect(G_OBJECT(local_video), "realize", |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
590 G_CALLBACK(realize_cb), data); |
26089
6c8eabbef4d3
Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26087
diff
changeset
|
591 gtk_container_add(GTK_CONTAINER(plug), local_video); |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
592 gtk_widget_set_size_request (GTK_WIDGET(local_video), 160, 120); |
26053
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
593 |
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
|
594 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
|
595 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
|
596 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
597 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
|
598 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
599 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
600 if (type & PURPLE_MEDIA_RECV_AUDIO) { |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
601 gtkmedia->priv->recv_progress = gtk_progress_bar_new(); |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
602 gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 70, 10); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
603 gtk_box_pack_end(GTK_BOX(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
|
604 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
|
605 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
|
606 } |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
607 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
608 gtkmedia->priv->send_progress = gtk_progress_bar_new(); |
26147
09386489e6d1
Change the media window items' orientations to look better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26146
diff
changeset
|
609 gtk_widget_set_size_request(gtkmedia->priv->send_progress, 70, 10); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
610 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:
25720
diff
changeset
|
611 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:
25720
diff
changeset
|
612 gtk_widget_show(gtkmedia->priv->send_progress); |
25726
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25725
diff
changeset
|
613 |
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25725
diff
changeset
|
614 gtk_widget_show(gtkmedia->priv->mute); |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
615 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
616 |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
617 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
618 if (type & PURPLE_MEDIA_AUDIO) { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
619 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
620 g_signal_connect(G_OBJECT(bus), "message::element", |
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
621 G_CALLBACK(level_message_cb), gtkmedia); |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
622 gst_object_unref(bus); |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
623 } |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
624 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
625 if (send_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
626 gtkmedia->priv->send_widget = send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
627 if (recv_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
628 gtkmedia->priv->recv_widget = recv_widget; |
26027
94224a5563db
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26014
diff
changeset
|
629 |
26117
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
630 g_object_get(G_OBJECT(media), "initiator", &is_initiator, NULL); |
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
|
631 |
26117
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
632 if (is_initiator == FALSE) { |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
633 gchar *message; |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
634 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
635 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
636 gtkmedia->priv->screenname); |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
637 } else if (type & PURPLE_MEDIA_AUDIO) { |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
638 message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
639 gtkmedia->priv->screenname); |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
640 } else if (type & PURPLE_MEDIA_VIDEO) { |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
641 message = g_strdup_printf(_("%s wishes to start a video session with you."), |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
642 gtkmedia->priv->screenname); |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
643 } |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
644 pidgin_media_emit_message(gtkmedia, message); |
958a5d614f71
Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26116
diff
changeset
|
645 g_free(message); |
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
|
646 } |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
647 |
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
648 gtk_widget_show(gtkmedia->priv->display); |
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
|
649 } |
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
|
650 |
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
|
651 static void |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
652 pidgin_media_state_changed_cb(PurpleMedia *media, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
653 PurpleMediaStateChangedType type, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
654 gchar *sid, gchar *name, PidginMedia *gtkmedia) |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
655 { |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
656 purple_debug_info("gtkmedia", "type: %d sid: %s name: %s\n", |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
657 type, sid, name); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
658 if (sid == NULL && name == NULL) { |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
659 if (type == PURPLE_MEDIA_STATE_CHANGED_END) { |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
660 pidgin_media_emit_message(gtkmedia, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
661 _("The call has been terminated.")); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
662 gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
663 |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
664 } else if (type == PURPLE_MEDIA_STATE_CHANGED_REJECTED) { |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
665 pidgin_media_emit_message(gtkmedia, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
666 _("You have rejected the call.")); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
667 } |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
668 } else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW && |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
669 sid != NULL && name != NULL) { |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
670 pidgin_media_ready_cb(media, gtkmedia, sid); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
671 } |
25550 | 672 } |
673 | |
674 static void | |
675 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) | |
676 { | |
677 PidginMedia *media; | |
678 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
|
679 |
25550 | 680 media = PIDGIN_MEDIA(object); |
681 switch (prop_id) { | |
682 case PROP_MEDIA: | |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
683 { |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
684 gboolean initiator; |
25550 | 685 if (media->priv->media) |
686 g_object_unref(media->priv->media); | |
687 media->priv->media = g_value_get_object(value); | |
688 g_object_ref(media->priv->media); | |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
689 |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
690 g_object_get(G_OBJECT(media->priv->media), |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
691 "initiator", &initiator, NULL); |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
692 if (initiator == TRUE) |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
693 pidgin_media_set_state(media, PIDGIN_MEDIA_WAITING); |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
694 else |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
695 pidgin_media_set_state(media, PIDGIN_MEDIA_REQUESTED); |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
696 |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
697 g_signal_connect(G_OBJECT(media->priv->media), "error", |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
698 G_CALLBACK(pidgin_media_error_cb), media); |
26143
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
699 g_signal_connect(G_OBJECT(media->priv->media), "accepted", |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
700 G_CALLBACK(pidgin_media_accepted_cb), media); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
701 g_signal_connect(G_OBJECT(media->priv->media), "state-changed", |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
702 G_CALLBACK(pidgin_media_state_changed_cb), media); |
25550 | 703 break; |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
704 } |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
705 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
706 if (media->priv->screenname) |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
707 g_free(media->priv->screenname); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
708 media->priv->screenname = g_value_dup_string(value); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
709 break; |
25550 | 710 case PROP_SEND_LEVEL: |
711 if (media->priv->send_level) | |
712 gst_object_unref(media->priv->send_level); | |
713 media->priv->send_level = g_value_get_object(value); | |
714 g_object_ref(media->priv->send_level); | |
715 break; | |
716 case PROP_RECV_LEVEL: | |
717 if (media->priv->recv_level) | |
718 gst_object_unref(media->priv->recv_level); | |
719 media->priv->recv_level = g_value_get_object(value); | |
720 g_object_ref(media->priv->recv_level); | |
721 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
722 default: |
25550 | 723 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
724 break; | |
725 } | |
726 } | |
727 | |
728 static void | |
729 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
730 { | |
731 PidginMedia *media; | |
732 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
|
733 |
25550 | 734 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
|
735 |
25550 | 736 switch (prop_id) { |
737 case PROP_MEDIA: | |
738 g_value_set_object(value, media->priv->media); | |
739 break; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
740 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
741 g_value_set_string(value, media->priv->screenname); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
742 break; |
25550 | 743 case PROP_SEND_LEVEL: |
744 g_value_set_object(value, media->priv->send_level); | |
745 break; | |
746 case PROP_RECV_LEVEL: | |
747 g_value_set_object(value, media->priv->recv_level); | |
748 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
749 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
750 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
25550 | 751 break; |
752 } | |
753 } | |
754 | |
755 GtkWidget * | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
756 pidgin_media_new(PurpleMedia *media, const gchar *screenname) |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
757 { |
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
|
758 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(), |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
759 "media", media, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
760 "screenname", screenname, NULL); |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
761 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
|
762 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
763 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
764 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
|
765 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
25550 | 766 { |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
767 gtkmedia->priv->state = state; |
25550 | 768 } |
769 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
770 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
771 pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
772 PurpleConnection *pc, gchar *screenname, gpointer nul) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
773 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
774 PidginMedia *gtkmedia = PIDGIN_MEDIA( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
775 pidgin_media_new(media, screenname)); |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
776 gboolean initiator; |
26151
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
777 PurpleBuddy *buddy = purple_find_buddy( |
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
778 purple_connection_get_account(pc), screenname); |
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
779 const gchar *alias = buddy ? |
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
780 purple_buddy_get_contact_alias(buddy) : screenname; |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
781 gtkmedia->priv->pc = pc; |
26151
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
782 gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
783 |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
784 g_object_get(G_OBJECT(media), "initiator", &initiator, NULL); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
785 if (initiator == FALSE) { |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
786 gchar *message = g_strdup_printf("%s wishes to start a " |
26151
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
787 "media session with you\n", alias); |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
788 purple_request_accept_cancel(media, "Media invitation", |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
789 message, NULL, 1, (void*)pc, screenname, |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
790 NULL, media, purple_media_accept, |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
791 purple_media_reject); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
792 g_free(message); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
793 } else |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
794 gtk_widget_show(GTK_WIDGET(gtkmedia)); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
795 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
796 return TRUE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
797 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
798 |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
799 static GstElement * |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
800 create_default_video_src(void) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
801 { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
802 GstElement *ret = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
803 purple_media_video_init_src(&ret); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
804 return ret; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
805 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
806 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
807 static GstElement * |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
808 create_default_video_sink(void) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
809 { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
810 GstElement *ret = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
811 purple_media_video_init_recv(&ret); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
812 return ret; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
813 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
814 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
815 static GstElement * |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
816 create_default_audio_src(void) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
817 { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
818 GstElement *ret = NULL, *level = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
819 purple_media_audio_init_src(&ret, &level); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
820 return ret; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
821 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
822 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
823 static GstElement * |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
824 create_default_audio_sink(void) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
825 { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
826 GstElement *ret = NULL, *level = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
827 purple_media_audio_init_recv(&ret, &level); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
828 return ret; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
829 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
830 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
831 static PurpleMediaElementInfo default_video_src = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
832 { |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
833 "pidgindefaultvideosrc", /* id */ |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
834 PURPLE_MEDIA_ELEMENT_VIDEO /* type */ |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
835 | PURPLE_MEDIA_ELEMENT_SRC |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
836 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
837 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
838 create_default_video_src, /* create */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
839 }; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
840 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
841 static PurpleMediaElementInfo default_video_sink = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
842 { |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
843 "pidgindefaultvideosink", /* id */ |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
844 PURPLE_MEDIA_ELEMENT_VIDEO /* type */ |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
845 | PURPLE_MEDIA_ELEMENT_SINK |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
846 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
847 create_default_video_sink, /* create */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
848 }; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
849 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
850 static PurpleMediaElementInfo default_audio_src = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
851 { |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
852 "pidgindefaultaudiosrc", /* id */ |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
853 PURPLE_MEDIA_ELEMENT_AUDIO /* type */ |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
854 | PURPLE_MEDIA_ELEMENT_SRC |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
855 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
856 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
857 create_default_audio_src, /* create */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
858 }; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
859 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
860 static PurpleMediaElementInfo default_audio_sink = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
861 { |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
862 "pidgindefaultaudiosink", /* id */ |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
863 PURPLE_MEDIA_ELEMENT_AUDIO /* type */ |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
864 | PURPLE_MEDIA_ELEMENT_SINK |
26164
fc100e71de5d
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
865 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
866 create_default_audio_sink, /* create */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
867 }; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
868 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
869 void |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
870 pidgin_medias_init(void) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
871 { |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
872 PurpleMediaManager *manager = purple_media_manager_get(); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
873 g_signal_connect(G_OBJECT(manager), "init-media", |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
874 G_CALLBACK(pidgin_media_new_cb), NULL); |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
875 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
876 purple_debug_info("gtkmedia", "Registering media element types\n"); |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
877 purple_media_manager_set_active_element(manager, &default_video_src); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
878 purple_media_manager_set_active_element(manager, &default_video_sink); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
879 purple_media_manager_set_active_element(manager, &default_audio_src); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
880 purple_media_manager_set_active_element(manager, &default_audio_sink); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
881 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
882 |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
883 #endif /* USE_VV */ |