Mercurial > pidgin.yaz
annotate pidgin/gtkmedia.c @ 27961:ffeb36ec8078
pidgin should handle 2byte hexadecimal numeric character reference.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Sat, 04 Jul 2009 23:40:15 +0000 |
parents | df9042312063 |
children | 6e3c83e1057c 20798dc089af |
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 |
26506
beb22a90bf5d
Gstreamer shouldn't be a requirement if USE_VV isn't defined.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
26497
diff
changeset
|
39 #include "media-gst.h" |
25550 | 40 |
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
|
41 #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
|
42 |
26455
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
43 #define PIDGIN_TYPE_MEDIA (pidgin_media_get_type()) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
44 #define PIDGIN_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_MEDIA, PidginMedia)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
45 #define PIDGIN_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
46 #define PIDGIN_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_MEDIA)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
47 #define PIDGIN_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_MEDIA)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
48 #define PIDGIN_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
49 |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
50 typedef struct _PidginMedia PidginMedia; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
51 typedef struct _PidginMediaClass PidginMediaClass; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
52 typedef struct _PidginMediaPrivate PidginMediaPrivate; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
53 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
54 typedef enum |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
55 { |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
56 /* Waiting for response */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
57 PIDGIN_MEDIA_WAITING = 1, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
58 /* Got request */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
59 PIDGIN_MEDIA_REQUESTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
60 /* Accepted call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
61 PIDGIN_MEDIA_ACCEPTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
62 /* Rejected call */ |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
63 PIDGIN_MEDIA_REJECTED, |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
64 } PidginMediaState; |
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
65 |
26455
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
66 struct _PidginMediaClass |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
67 { |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
68 GtkWindowClass parent_class; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
69 }; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
70 |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
71 struct _PidginMedia |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
72 { |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
73 GtkWindow parent; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
74 PidginMediaPrivate *priv; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
75 }; |
84374a764255
Hide PidginMedia and related structs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26454
diff
changeset
|
76 |
25550 | 77 struct _PidginMediaPrivate |
78 { | |
79 PurpleMedia *media; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
80 gchar *screenname; |
25550 | 81 GstElement *send_level; |
82 GstElement *recv_level; | |
83 | |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
84 GtkItemFactory *item_factory; |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
85 GtkWidget *menubar; |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
86 GtkWidget *statusbar; |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
87 |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
88 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
|
89 |
25550 | 90 GtkWidget *send_progress; |
91 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
|
92 |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
93 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
|
94 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
95 GtkWidget *display; |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
96 GtkWidget *send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
97 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
|
98 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
|
99 GtkWidget *remote_video; |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
100 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
101 guint timeout_id; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
102 PurpleMediaSessionType request_type; |
25550 | 103 }; |
104 | |
105 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
106 | |
107 static void pidgin_media_class_init (PidginMediaClass *klass); | |
108 static void pidgin_media_init (PidginMedia *media); | |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
109 static void pidgin_media_dispose (GObject *object); |
25550 | 110 static void pidgin_media_finalize (GObject *object); |
111 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
112 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
|
113 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
25550 | 114 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
115 static GtkWindowClass *parent_class = NULL; |
25550 | 116 |
117 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
118 #if 0 |
25550 | 119 enum { |
120 LAST_SIGNAL | |
121 }; | |
122 static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
123 #endif |
25550 | 124 |
125 enum { | |
126 PROP_0, | |
127 PROP_MEDIA, | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
128 PROP_SCREENNAME, |
25550 | 129 PROP_SEND_LEVEL, |
130 PROP_RECV_LEVEL | |
131 }; | |
132 | |
26456 | 133 static GType |
25634
741a702033e0
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25561
diff
changeset
|
134 pidgin_media_get_type(void) |
25550 | 135 { |
136 static GType type = 0; | |
137 | |
138 if (type == 0) { | |
139 static const GTypeInfo info = { | |
140 sizeof(PidginMediaClass), | |
141 NULL, | |
142 NULL, | |
143 (GClassInitFunc) pidgin_media_class_init, | |
144 NULL, | |
145 NULL, | |
146 sizeof(PidginMedia), | |
147 0, | |
25561
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
148 (GInstanceInitFunc) pidgin_media_init, |
1ec6a26cfefc
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25550
diff
changeset
|
149 NULL |
25550 | 150 }; |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
151 type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0); |
25550 | 152 } |
153 return type; | |
154 } | |
155 | |
156 | |
157 static void | |
158 pidgin_media_class_init (PidginMediaClass *klass) | |
159 { | |
160 GObjectClass *gobject_class = (GObjectClass*)klass; | |
25679 | 161 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
25550 | 162 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
|
163 |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
164 gobject_class->dispose = pidgin_media_dispose; |
25550 | 165 gobject_class->finalize = pidgin_media_finalize; |
166 gobject_class->set_property = pidgin_media_set_property; | |
167 gobject_class->get_property = pidgin_media_get_property; | |
168 | |
169 g_object_class_install_property(gobject_class, PROP_MEDIA, | |
170 g_param_spec_object("media", | |
171 "PurpleMedia", | |
172 "The PurpleMedia associated with this media.", | |
173 PURPLE_TYPE_MEDIA, | |
174 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
|
175 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
|
176 g_param_spec_string("screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
177 "Screenname", |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
178 "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
|
179 NULL, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
180 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
25550 | 181 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL, |
182 g_param_spec_object("send-level", | |
183 "Send level", | |
184 "The GstElement of this media's send 'level'", | |
185 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
|
186 G_PARAM_READWRITE)); |
25550 | 187 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL, |
188 g_param_spec_object("recv-level", | |
189 "Receive level", | |
190 "The GstElement of this media's recv 'level'", | |
191 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
|
192 G_PARAM_READWRITE)); |
25550 | 193 |
194 g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
195 } | |
196 | |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
197 static void |
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
198 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
|
199 { |
26454
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
200 purple_media_stream_info(media->priv->media, |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
201 gtk_toggle_button_get_active(toggle) ? |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
202 PURPLE_MEDIA_INFO_MUTE : PURPLE_MEDIA_INFO_UNMUTE, |
d254bc6b4d60
Remove purple_media_mute.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26453
diff
changeset
|
203 NULL, NULL, TRUE); |
25713
4eae2d40f11b
Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
204 } |
25550 | 205 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
206 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
207 pidgin_media_delete_event_cb(GtkWidget *widget, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
208 GdkEvent *event, PidginMedia *media) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
209 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
210 if (media->priv->media) |
26451
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
211 purple_media_stream_info(media->priv->media, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
212 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
213 return FALSE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
214 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
215 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
216 static int |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
217 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
|
218 { |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
219 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
|
220 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
|
221 #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
|
222 XERRORCASE(BadAccess); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
223 XERRORCASE(BadAlloc); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
224 XERRORCASE(BadAtom); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
225 XERRORCASE(BadColor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
226 XERRORCASE(BadCursor); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
227 XERRORCASE(BadDrawable); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
228 XERRORCASE(BadFont); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
229 XERRORCASE(BadGC); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
230 XERRORCASE(BadIDChoice); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
231 XERRORCASE(BadImplementation); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
232 XERRORCASE(BadLength); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
233 XERRORCASE(BadMatch); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
234 XERRORCASE(BadName); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
235 XERRORCASE(BadPixmap); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
236 XERRORCASE(BadRequest); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
237 XERRORCASE(BadValue); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
238 XERRORCASE(BadWindow); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
239 #undef XERRORCASE |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
240 default: |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
241 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
|
242 break; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
243 } |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
244 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
|
245 "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
|
246 error_type); |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
247 return 0; |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
248 } |
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
249 |
25550 | 250 static void |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
251 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
|
252 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
253 PidginMedia *gtkmedia = PIDGIN_MEDIA(data); |
26451
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
254 purple_media_stream_info(gtkmedia->priv->media, |
2862fee7acf2
Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26448
diff
changeset
|
255 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
256 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
257 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
258 static GtkItemFactoryEntry menu_items[] = { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
259 { 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
|
260 { 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
|
261 }; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
262 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
263 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
|
264 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
265 static const char * |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
266 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
|
267 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
268 return _(path); |
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 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
271 static GtkWidget * |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
272 setup_menubar(PidginMedia *window) |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
273 { |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
274 GtkAccelGroup *accel_group; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
275 GtkWidget *menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
276 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
277 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
|
278 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
|
279 g_object_unref(accel_group); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
280 |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
281 window->priv->item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
282 "<main>", accel_group); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
283 |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
284 gtk_item_factory_set_translate_func(window->priv->item_factory, |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
285 (GtkTranslateFunc)item_factory_translate_func, |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
286 NULL, NULL); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
287 |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
288 gtk_item_factory_create_items(window->priv->item_factory, |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
289 menu_item_count, menu_items, window); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
290 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
|
291 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
|
292 |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
293 menu = gtk_item_factory_get_widget( |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
294 window->priv->item_factory, "<main>"); |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
295 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
296 gtk_widget_show(menu); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
297 return menu; |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
298 } |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
299 |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
300 static void |
25550 | 301 pidgin_media_init (PidginMedia *media) |
302 { | |
26492
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
303 GtkWidget *vbox; |
25550 | 304 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
305 |
26159
46a6ba93c376
Implement an X error handler to prevent Pidgin from crashing on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26158
diff
changeset
|
306 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
|
307 |
26433
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
308 vbox = gtk_vbox_new(FALSE, 0); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
309 gtk_container_add(GTK_CONTAINER(media), vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
310 |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
311 media->priv->statusbar = gtk_statusbar_new(); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
312 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
|
313 FALSE, FALSE, 0); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
314 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
|
315 0, _("Calling...")); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
316 gtk_widget_show(media->priv->statusbar); |
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
317 |
26174
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
318 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
|
319 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
|
320 FALSE, TRUE, 0); |
cc96a5ec4782
Add a basic menu to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
321 |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
322 media->priv->display = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
26433
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
323 gtk_container_set_border_width(GTK_CONTAINER(media->priv->display), |
0dfd05966e09
Improve padding in media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
324 PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
325 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
|
326 TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
327 gtk_widget_show(vbox); |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
328 |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
329 g_signal_connect(G_OBJECT(media), "delete-event", |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
330 G_CALLBACK(pidgin_media_delete_event_cb), media); |
25550 | 331 } |
332 | |
333 static gboolean | |
334 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) | |
335 { | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
336 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
|
337 gdouble percent; |
25550 | 338 const GValue *list; |
339 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
|
340 |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
341 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
|
342 GtkWidget *progress; |
25550 | 343 |
344 if (message->type != GST_MESSAGE_ELEMENT) | |
345 return TRUE; | |
346 | |
26401 | 347 if (!gst_structure_has_name( |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
348 gst_message_get_structure(message), "level")) |
25550 | 349 return TRUE; |
350 | |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
351 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
|
352 progress = gtkmedia->priv->send_progress; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
353 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
|
354 progress = gtkmedia->priv->recv_progress; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
355 else |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
356 return TRUE; |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
357 |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
358 list = gst_structure_get_value( |
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
359 gst_message_get_structure(message), "rms"); |
25550 | 360 |
361 /* Only bother with the first channel. */ | |
362 value = gst_value_list_get_value(list, 0); | |
363 rms_db = g_value_get_double(value); | |
364 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
365 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
|
366 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
367 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
|
368 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
|
369 |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26151
diff
changeset
|
370 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), percent); |
25550 | 371 return TRUE; |
372 } | |
373 | |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
374 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
375 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
|
376 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
|
377 { |
26475
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
378 PurpleMediaManager *manager = purple_media_get_manager(media); |
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
379 GstElement *element = purple_media_manager_get_pipeline(manager); |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
380 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
|
381 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
|
382 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
|
383 if (handler_id) |
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
384 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
|
385 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
|
386 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
387 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
388 static void |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
389 pidgin_media_dispose(GObject *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 PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
392 purple_debug_info("gtkmedia", "pidgin_media_dispose\n"); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
393 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
394 if (gtkmedia->priv->media) { |
26177
8b95080061ed
Close the request dialog if the remote user hung up.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26176
diff
changeset
|
395 purple_request_close_with_handle(gtkmedia); |
26157
1aed9a92b657
Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
396 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
|
397 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
398 g_object_unref(gtkmedia->priv->media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
399 gtkmedia->priv->media = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
400 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
401 |
26175
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
402 if (gtkmedia->priv->item_factory) { |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
403 g_object_unref(gtkmedia->priv->item_factory); |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
404 gtkmedia->priv->item_factory = NULL; |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
405 } |
1830d339f9b9
Properly free item factory. Should fix a crash on close.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26174
diff
changeset
|
406 |
26087
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
407 if (gtkmedia->priv->send_level) { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
408 gst_object_unref(gtkmedia->priv->send_level); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
409 gtkmedia->priv->send_level = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
410 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
411 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
412 if (gtkmedia->priv->recv_level) { |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
413 gst_object_unref(gtkmedia->priv->recv_level); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
414 gtkmedia->priv->recv_level = NULL; |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
415 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
416 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
417 G_OBJECT_CLASS(parent_class)->dispose(media); |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
418 } |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
419 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
420 static void |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
421 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
|
422 { |
26131
6eeb500ce9a2
Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26130
diff
changeset
|
423 /* 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
|
424 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
|
425 |
83704757fa36
Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
426 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
|
427 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
428 |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
429 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
|
430 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
|
431 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
432 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
433 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
434 purple_media_get_account(gtkmedia->priv->media)); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
435 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
436 purple_conversation_write(conv, NULL, msg, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
437 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
|
438 } |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25643
diff
changeset
|
439 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
440 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
|
441 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
442 PidginMedia *gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
443 gchar *session_id; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
444 gchar *participant; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
445 } 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
|
446 |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
447 static gboolean |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
448 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
|
449 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
450 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
|
451 gulong window_id; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
452 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
453 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
|
454 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
|
455 else |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
456 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
|
457 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
458 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
|
459 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
|
460 |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
461 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
|
462 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
|
463 g_free(data); |
26107
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
464 return FALSE; |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
465 } |
4859b0b82289
Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26089
diff
changeset
|
466 |
25550 | 467 static void |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
468 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
|
469 { |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
470 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
|
471 } |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
472 |
99c3489e06b0
Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26034
diff
changeset
|
473 static void |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
474 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
|
475 { |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
476 PurpleConversation *conv = purple_find_conversation_with_account( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
477 PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
478 purple_media_get_account(gtkmedia->priv->media)); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
479 if (conv != NULL) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
480 purple_conversation_write(conv, NULL, error, |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
481 PURPLE_MESSAGE_ERROR, time(NULL)); |
26161
2b843d38d1f2
Add statusbar to eventually replace the label.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26160
diff
changeset
|
482 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
|
483 0, error); |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
484 } |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
485 |
26143
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
486 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
|
487 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
|
488 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
|
489 { |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
490 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
|
491 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
|
492 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
|
493 0, _("Call in progress.")); |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
494 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
|
495 } |
f6a98b2b8d92
Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26135
diff
changeset
|
496 |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
497 static void |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
498 pidgin_media_accept_cb(PurpleMedia *media, int index) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
499 { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
500 purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
501 NULL, NULL, TRUE); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
502 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
503 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
504 static void |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
505 pidgin_media_reject_cb(PurpleMedia *media, int index) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
506 { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
507 purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
508 NULL, NULL, TRUE); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
509 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
510 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
511 static gboolean |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
512 pidgin_request_timeout_cb(PidginMedia *gtkmedia) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
513 { |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
514 PurpleAccount *account; |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
515 PurpleBuddy *buddy; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
516 const gchar *alias; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
517 PurpleMediaSessionType type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
518 gchar *message = NULL; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
519 |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
520 account = purple_media_get_account(gtkmedia->priv->media); |
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
521 buddy = purple_find_buddy(account, gtkmedia->priv->screenname); |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
522 alias = buddy ? purple_buddy_get_contact_alias(buddy) : |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
523 gtkmedia->priv->screenname; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
524 type = gtkmedia->priv->request_type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
525 gtkmedia->priv->timeout_id = 0; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
526 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
527 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
528 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
529 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
530 } else if (type & PURPLE_MEDIA_AUDIO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
531 message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
532 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
533 } else if (type & PURPLE_MEDIA_VIDEO) { |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
534 message = g_strdup_printf(_("%s wishes to start a video session with you."), |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
535 alias); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
536 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
537 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
538 gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
539 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
540 purple_request_accept_cancel(gtkmedia, "Media invitation", |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
541 message, NULL, PURPLE_DEFAULT_ACTION_NONE, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
542 (void*)account, gtkmedia->priv->screenname, NULL, |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
543 gtkmedia->priv->media, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
544 pidgin_media_accept_cb, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
545 pidgin_media_reject_cb); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
546 pidgin_media_emit_message(gtkmedia, message); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
547 g_free(message); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
548 return FALSE; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
549 } |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
550 |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
551 static void |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
552 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
553 pidgin_media_input_volume_changed(GtkScaleButton *range, double value, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
554 PurpleMedia *media) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
555 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
556 double val = (double)value * 100.0; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
557 #else |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
558 pidgin_media_input_volume_changed(GtkRange *range, PurpleMedia *media) |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
559 { |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
560 double val = (double)gtk_range_get_value(GTK_RANGE(range)); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
561 #endif |
26497
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
562 purple_prefs_set_int("/pidgin/media/audio/volume/input", val); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
563 purple_media_set_input_volume(media, NULL, val / 10.0); |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
564 } |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
565 |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
566 static void |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
567 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
568 pidgin_media_output_volume_changed(GtkScaleButton *range, double value, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
569 PurpleMedia *media) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
570 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
571 double val = (double)value * 100.0; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
572 #else |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
573 pidgin_media_output_volume_changed(GtkRange *range, PurpleMedia *media) |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
574 { |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
575 double val = (double)gtk_range_get_value(GTK_RANGE(range)); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
576 #endif |
26497
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
577 purple_prefs_set_int("/pidgin/media/audio/volume/output", val); |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
578 purple_media_set_output_volume(media, NULL, NULL, val / 10.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
579 } |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
580 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
581 static GtkWidget * |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
582 pidgin_media_add_audio_widget(PidginMedia *gtkmedia, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
583 PurpleMediaSessionType type) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
584 { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
585 GtkWidget *volume_widget, *progress_parent, *volume, *progress; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
586 double value; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
587 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
588 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
589 value = purple_prefs_get_int( |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
590 "/pidgin/media/audio/volume/input"); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
591 } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
592 value = purple_prefs_get_int( |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
593 "/pidgin/media/audio/volume/output"); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
594 } else |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
595 g_return_val_if_reached(NULL); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
596 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
597 #if GTK_CHECK_VERSION(2,12,0) |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
598 /* Setup widget structure */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
599 volume_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
600 progress_parent = gtk_vbox_new(FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
601 gtk_box_pack_start(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
602 progress_parent, TRUE, TRUE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
603 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
604 /* Volume button */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
605 volume = gtk_volume_button_new(); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
606 gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume), value/100.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
607 gtk_box_pack_end(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
608 volume, FALSE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
609 #else |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
610 /* Setup widget structure */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
611 volume_widget = gtk_vbox_new(FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
612 progress_parent = volume_widget; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
613 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
614 /* Volume slider */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
615 volume = gtk_hscale_new_with_range(0.0, 100.0, 5.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
616 gtk_range_set_increments(GTK_RANGE(volume), 5.0, 25.0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
617 gtk_range_set_value(GTK_RANGE(volume), value); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
618 gtk_scale_set_draw_value(GTK_SCALE(volume), FALSE); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
619 gtk_box_pack_end(GTK_BOX(volume_widget), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
620 volume, TRUE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
621 #endif |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
622 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
623 /* Volume level indicator */ |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
624 progress = gtk_progress_bar_new(); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
625 gtk_widget_set_size_request(progress, 250, 10); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
626 gtk_box_pack_end(GTK_BOX(progress_parent), progress, TRUE, FALSE, 0); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
627 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
628 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
629 g_signal_connect (G_OBJECT(volume), "value-changed", |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
630 G_CALLBACK(pidgin_media_input_volume_changed), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
631 gtkmedia->priv->media); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
632 gtkmedia->priv->send_progress = progress; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
633 } else if (type & PURPLE_MEDIA_RECV_AUDIO) { |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
634 g_signal_connect (G_OBJECT(volume), "value-changed", |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
635 G_CALLBACK(pidgin_media_output_volume_changed), |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
636 gtkmedia->priv->media); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
637 gtkmedia->priv->recv_progress = progress; |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
638 } |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
639 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
640 gtk_widget_show_all(volume_widget); |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
641 |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
642 return volume_widget; |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
643 } |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
644 |
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
645 static void |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
646 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) |
25550 | 647 { |
26475
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
648 PurpleMediaManager *manager = purple_media_get_manager(media); |
462e5c27dbd7
Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
649 GstElement *pipeline = purple_media_manager_get_pipeline(manager); |
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
|
650 GtkWidget *send_widget = NULL, *recv_widget = NULL; |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
651 PurpleMediaSessionType type = |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
652 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
|
653 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
654 if (gtkmedia->priv->recv_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
655 && type & (PURPLE_MEDIA_RECV_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
656 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
|
657 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
|
658 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
|
659 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
|
660 gtk_widget_show(recv_widget); |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
661 } else |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
662 recv_widget = gtkmedia->priv->recv_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
663 if (gtkmedia->priv->send_widget == NULL |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
664 && type & (PURPLE_MEDIA_SEND_VIDEO | |
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
665 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
|
666 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
|
667 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
|
668 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
|
669 gtk_widget_show(send_widget); |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
670 } else |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
671 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
|
672 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
673 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
|
674 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
|
675 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
|
676 GtkWidget *remote_video; |
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
|
677 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
|
678 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
679 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
|
680 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
|
681 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
|
682 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
683 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
|
684 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
685 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
|
686 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
|
687 |
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
|
688 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
|
689 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
|
690 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
|
691 G_CALLBACK(realize_cb), data); |
26516
30c870ee4ec9
Remove old GtkPlug and GtkSocket code.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26506
diff
changeset
|
692 gtk_container_add(GTK_CONTAINER(aspect), remote_video); |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
693 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
|
694 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
|
695 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
|
696 |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
697 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
|
698 } |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
699 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
|
700 PidginMediaRealizeData *data; |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
701 GtkWidget *aspect; |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
702 GtkWidget *local_video; |
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
|
703 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
|
704 |
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
|
705 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
|
706 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
|
707 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
|
708 |
26135
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
709 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
|
710 data->gtkmedia = gtkmedia; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
711 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
|
712 data->participant = NULL; |
c334a9e17426
Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26131
diff
changeset
|
713 |
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
|
714 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
|
715 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
|
716 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
|
717 G_CALLBACK(realize_cb), data); |
26516
30c870ee4ec9
Remove old GtkPlug and GtkSocket code.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26506
diff
changeset
|
718 gtk_container_add(GTK_CONTAINER(aspect), local_video); |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
719 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
|
720 |
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
|
721 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
|
722 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
|
723 |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
724 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
|
725 } |
3bf9748fdef0
Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25679
diff
changeset
|
726 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
727 if (type & PURPLE_MEDIA_RECV_AUDIO) { |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
728 gtk_box_pack_end(GTK_BOX(recv_widget), |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
729 pidgin_media_add_audio_widget(gtkmedia, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
730 PURPLE_MEDIA_RECV_AUDIO), FALSE, FALSE, 0); |
25688
9c6915254610
Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25687
diff
changeset
|
731 } |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
732 if (type & PURPLE_MEDIA_SEND_AUDIO) { |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
733 GstElement *media_src; |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
734 GtkWidget *hbox; |
26492
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
735 |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
736 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
737 gtk_box_pack_end(GTK_BOX(send_widget), hbox, FALSE, FALSE, 0); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
738 gtkmedia->priv->mute = |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
739 gtk_toggle_button_new_with_mnemonic("_Mute"); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
740 g_signal_connect(gtkmedia->priv->mute, "toggled", |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
741 G_CALLBACK(pidgin_media_mute_toggled), |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
742 gtkmedia); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
743 gtk_box_pack_end(GTK_BOX(hbox), gtkmedia->priv->mute, |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
744 FALSE, FALSE, 0); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
745 gtk_widget_show(gtkmedia->priv->mute); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
746 gtk_widget_show(GTK_WIDGET(hbox)); |
343ca84d5997
Improve the padding around the mute button.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26491
diff
changeset
|
747 |
26490
ee0282fe3673
Move volume levels for media to the media window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26487
diff
changeset
|
748 media_src = purple_media_get_src(media, sid); |
26401 | 749 gtkmedia->priv->send_level = gst_bin_get_by_name( |
750 GST_BIN(media_src), "sendlevel"); | |
751 | |
25725
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
752 gtk_box_pack_end(GTK_BOX(send_widget), |
26596
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
753 pidgin_media_add_audio_widget(gtkmedia, |
9cb62ecb4715
Use GtkVolumeButtons for audio if it's available.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26516
diff
changeset
|
754 PURPLE_MEDIA_SEND_AUDIO), FALSE, FALSE, 0); |
25726
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25725
diff
changeset
|
755 |
eb289e9086bf
Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25725
diff
changeset
|
756 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
|
757 } |
64080c01ee50
Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25720
diff
changeset
|
758 |
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
|
759 |
26146
4f013819e4e3
Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26145
diff
changeset
|
760 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
|
761 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
|
762 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
|
763 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
|
764 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
|
765 } |
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
|
766 |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
767 if (send_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
768 gtkmedia->priv->send_widget = send_widget; |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
769 if (recv_widget != NULL) |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
770 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
|
771 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
772 if (purple_media_is_initiator(media, sid, NULL) == FALSE) { |
26464
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
773 if (gtkmedia->priv->timeout_id != 0) |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
774 g_source_remove(gtkmedia->priv->timeout_id); |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
775 gtkmedia->priv->request_type |= type; |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
776 gtkmedia->priv->timeout_id = g_timeout_add(500, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
777 (GSourceFunc)pidgin_request_timeout_cb, |
f42892982e30
Display which type of media session is being requested.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26462
diff
changeset
|
778 gtkmedia); |
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
|
779 } |
26160
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
780 |
27b553a07800
Make the sinks better default sizes and display them immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26159
diff
changeset
|
781 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
|
782 } |
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
|
783 |
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
|
784 static void |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
785 pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
786 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
|
787 { |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
788 purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n", |
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
789 state, sid, name); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
790 if (sid == NULL && name == NULL) { |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
791 if (state == PURPLE_MEDIA_STATE_END) { |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
792 pidgin_media_emit_message(gtkmedia, |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
793 _("The call has been terminated.")); |
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
794 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
|
795 } |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
796 } else if (state == PURPLE_MEDIA_STATE_NEW && |
26116
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
797 sid != NULL && name != NULL) { |
3b82059e4069
Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26115
diff
changeset
|
798 pidgin_media_ready_cb(media, gtkmedia, sid); |
26411
86bc2d34f689
Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26406
diff
changeset
|
799 } else if (state == PURPLE_MEDIA_STATE_CONNECTED && |
26401 | 800 purple_media_get_session_type(media, sid) & |
801 PURPLE_MEDIA_RECV_AUDIO) { | |
26419
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
802 GstElement *tee = purple_media_get_tee(media, sid, name); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
803 GstIterator *iter = gst_element_iterate_src_pads(tee); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
804 GstPad *sinkpad; |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
805 if (gst_iterator_next(iter, (gpointer)&sinkpad) |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
806 == GST_ITERATOR_OK) { |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
807 GstPad *peer = gst_pad_get_peer(sinkpad); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
808 if (peer != NULL) { |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
809 gtkmedia->priv->recv_level = |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
810 gst_bin_get_by_name( |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
811 GST_BIN(GST_OBJECT_PARENT( |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
812 peer)), "recvlevel"); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
813 gst_object_unref(peer); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
814 } |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
815 gst_object_unref(sinkpad); |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
816 } |
dd45432d6b69
Use purple_media_get_tee instead of purple_media_get_sink.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26411
diff
changeset
|
817 gst_iterator_free(iter); |
26114
2809a63dbadf
Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26108
diff
changeset
|
818 } |
25550 | 819 } |
820 | |
821 static void | |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
822 pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
26448
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26446
diff
changeset
|
823 gchar *sid, gchar *name, gboolean local, |
4e1286e76f1f
Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26446
diff
changeset
|
824 PidginMedia *gtkmedia) |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
825 { |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
826 if (type == PURPLE_MEDIA_INFO_REJECT) { |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
827 pidgin_media_emit_message(gtkmedia, |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
828 _("You have rejected the call.")); |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
829 } |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
830 } |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
831 |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
832 static void |
25550 | 833 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
834 { | |
835 PidginMedia *media; | |
836 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
|
837 |
25550 | 838 media = PIDGIN_MEDIA(object); |
839 switch (prop_id) { | |
840 case PROP_MEDIA: | |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
841 { |
25550 | 842 if (media->priv->media) |
843 g_object_unref(media->priv->media); | |
844 media->priv->media = g_value_get_object(value); | |
845 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
|
846 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
847 if (purple_media_is_initiator(media->priv->media, |
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
848 NULL, NULL) == TRUE) |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
849 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
|
850 else |
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
851 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
|
852 |
26058
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
853 g_signal_connect(G_OBJECT(media->priv->media), "error", |
0ad1b8e950d7
Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26053
diff
changeset
|
854 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
|
855 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
|
856 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
|
857 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
|
858 G_CALLBACK(pidgin_media_state_changed_cb), media); |
26406
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
859 g_signal_connect(G_OBJECT(media->priv->media), "stream-info", |
065d865e7dd1
Use stream-info for reject instead of state-changed.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26401
diff
changeset
|
860 G_CALLBACK(pidgin_media_stream_info_cb), media); |
25550 | 861 break; |
26115
366f68124622
Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26114
diff
changeset
|
862 } |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
863 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
864 if (media->priv->screenname) |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
865 g_free(media->priv->screenname); |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
866 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
|
867 break; |
25550 | 868 case PROP_SEND_LEVEL: |
869 if (media->priv->send_level) | |
870 gst_object_unref(media->priv->send_level); | |
871 media->priv->send_level = g_value_get_object(value); | |
872 g_object_ref(media->priv->send_level); | |
873 break; | |
874 case PROP_RECV_LEVEL: | |
875 if (media->priv->recv_level) | |
876 gst_object_unref(media->priv->recv_level); | |
877 media->priv->recv_level = g_value_get_object(value); | |
878 g_object_ref(media->priv->recv_level); | |
879 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
880 default: |
25550 | 881 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
882 break; | |
883 } | |
884 } | |
885 | |
886 static void | |
887 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
888 { | |
889 PidginMedia *media; | |
890 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
|
891 |
25550 | 892 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
|
893 |
25550 | 894 switch (prop_id) { |
895 case PROP_MEDIA: | |
896 g_value_set_object(value, media->priv->media); | |
897 break; | |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
898 case PROP_SCREENNAME: |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
899 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
|
900 break; |
25550 | 901 case PROP_SEND_LEVEL: |
902 g_value_set_object(value, media->priv->send_level); | |
903 break; | |
904 case PROP_RECV_LEVEL: | |
905 g_value_set_object(value, media->priv->recv_level); | |
906 break; | |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
907 default: |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
908 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
25550 | 909 break; |
910 } | |
911 } | |
912 | |
26446
e114ed3c8cfe
No reason for this to be public API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26440
diff
changeset
|
913 static GtkWidget * |
26060
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
914 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
|
915 { |
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
|
916 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
|
917 "media", media, |
0829a08038c6
Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26058
diff
changeset
|
918 "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
|
919 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
|
920 } |
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
921 |
25643
befeece4dd48
Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25637
diff
changeset
|
922 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
|
923 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
25550 | 924 { |
25637
92e71f6e10d4
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25634
diff
changeset
|
925 gtkmedia->priv->state = state; |
25550 | 926 } |
927 | |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
928 static gboolean |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
929 pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
930 PurpleAccount *account, gchar *screenname, gpointer nul) |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
931 { |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
932 PidginMedia *gtkmedia = PIDGIN_MEDIA( |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
933 pidgin_media_new(media, screenname)); |
26606
df9042312063
Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26596
diff
changeset
|
934 PurpleBuddy *buddy = purple_find_buddy(account, screenname); |
26151
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
935 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
|
936 purple_buddy_get_contact_alias(buddy) : screenname; |
e6d548856fcd
Use aliases for the media window title and the request window.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26149
diff
changeset
|
937 gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
938 |
26466
bea334b214fa
Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26464
diff
changeset
|
939 if (purple_media_is_initiator(media, NULL, NULL) == TRUE) |
26149
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
940 gtk_widget_show(GTK_WIDGET(gtkmedia)); |
a6e53d23bcbb
Use request API for a media invitation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26148
diff
changeset
|
941 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
942 return TRUE; |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
943 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
944 |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
945 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
946 create_default_video_src(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
947 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
948 { |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
949 GstElement *sendbin, *src, *videoscale, *capsfilter; |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
950 GstPad *pad; |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
951 GstPad *ghost; |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
952 GstCaps *caps; |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
953 |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
954 src = gst_element_factory_make("gconfvideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
955 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
956 src = gst_element_factory_make("autovideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
957 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
958 src = gst_element_factory_make("v4l2src", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
959 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
960 src = gst_element_factory_make("v4lsrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
961 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
962 src = gst_element_factory_make("ksvideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
963 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
964 src = gst_element_factory_make("dshowvideosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
965 if (src == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
966 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
967 "element for the default video source.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
968 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
969 } |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
970 |
26459
452be048bded
Unique elements ought to be named the same as their id.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26457
diff
changeset
|
971 sendbin = gst_bin_new("pidgindefaultvideosrc"); |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
972 videoscale = gst_element_factory_make("videoscale", NULL); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
973 capsfilter = gst_element_factory_make("capsfilter", NULL); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
974 |
26439
c3ea7e628e58
Extend the range for video dimensions just a hair.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26433
diff
changeset
|
975 /* It was recommended to set the size <= 352x288 and framerate <= 20 */ |
c3ea7e628e58
Extend the range for video dimensions just a hair.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26433
diff
changeset
|
976 caps = gst_caps_from_string("video/x-raw-yuv , width=[250,352] , " |
26487
70ab418e9d4f
Have "no minimum framerate". Fixes khc's cam.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26484
diff
changeset
|
977 "height=[200,288] , framerate=[1/1,20/1]"); |
26424
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
978 g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
979 |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
980 gst_bin_add_many(GST_BIN(sendbin), src, |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
981 videoscale, capsfilter, NULL); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
982 gst_element_link_many(src, videoscale, capsfilter, NULL); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
983 |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
984 pad = gst_element_get_static_pad(capsfilter, "src"); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
985 ghost = gst_ghost_pad_new("ghostsrc", pad); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
986 gst_object_unref(pad); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
987 gst_element_add_pad(sendbin, ghost); |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
988 |
0c96ac2ea5f8
Remove purple_media_video_init_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26419
diff
changeset
|
989 return sendbin; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
990 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
991 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
992 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
993 create_default_video_sink(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
994 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
995 { |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
996 GstElement *sink = gst_element_factory_make("gconfvideosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
997 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
998 sink = gst_element_factory_make("autovideosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
999 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1000 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1001 "element for the default video sink.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1002 return sink; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1003 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1004 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1005 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1006 create_default_audio_src(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1007 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1008 { |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1009 GstElement *bin, *src, *volume, *level; |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1010 GstPad *pad, *ghost; |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1011 double input_volume = purple_prefs_get_int( |
26497
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1012 "/pidgin/media/audio/volume/input")/10.0; |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1013 |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1014 src = gst_element_factory_make("gconfaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1015 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1016 src = gst_element_factory_make("autoaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1017 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1018 src = gst_element_factory_make("alsasrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1019 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1020 src = gst_element_factory_make("osssrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1021 if (src == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1022 src = gst_element_factory_make("dshowaudiosrc", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1023 if (src == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1024 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1025 "element for the default audio source.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1026 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1027 } |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1028 |
26459
452be048bded
Unique elements ought to be named the same as their id.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26457
diff
changeset
|
1029 bin = gst_bin_new("pidgindefaultaudiosrc"); |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1030 volume = gst_element_factory_make("volume", "purpleaudioinputvolume"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1031 g_object_set(volume, "volume", input_volume, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1032 level = gst_element_factory_make("level", "sendlevel"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1033 gst_bin_add_many(GST_BIN(bin), src, volume, level, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1034 gst_element_link(src, volume); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1035 gst_element_link(volume, level); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1036 pad = gst_element_get_pad(level, "src"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1037 ghost = gst_ghost_pad_new("ghostsrc", pad); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1038 gst_element_add_pad(bin, ghost); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1039 g_object_set(G_OBJECT(level), "message", TRUE, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1040 |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1041 return bin; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1042 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1043 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1044 static GstElement * |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1045 create_default_audio_sink(PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26473
diff
changeset
|
1046 const gchar *session_id, const gchar *participant) |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1047 { |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1048 GstElement *bin, *sink, *volume, *level, *queue; |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1049 GstPad *pad, *ghost; |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1050 double output_volume = purple_prefs_get_int( |
26497
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1051 "/pidgin/media/audio/volume/output")/10.0; |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1052 |
26495
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1053 sink = gst_element_factory_make("gconfaudiosink", NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1054 if (sink == NULL) |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1055 sink = gst_element_factory_make("autoaudiosink",NULL); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1056 if (sink == NULL) { |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1057 purple_debug_error("gtkmedia", "Unable to find a suitable " |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1058 "element for the default audio sink.\n"); |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1059 return NULL; |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1060 } |
a198f064a42c
Use better choices for default elements and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26492
diff
changeset
|
1061 |
26425
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1062 bin = gst_bin_new("pidginrecvaudiobin"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1063 volume = gst_element_factory_make("volume", "purpleaudiooutputvolume"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1064 g_object_set(volume, "volume", output_volume, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1065 level = gst_element_factory_make("level", "recvlevel"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1066 queue = gst_element_factory_make("queue", NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1067 gst_bin_add_many(GST_BIN(bin), sink, volume, level, queue, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1068 gst_element_link(level, sink); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1069 gst_element_link(volume, level); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1070 gst_element_link(queue, volume); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1071 pad = gst_element_get_pad(queue, "sink"); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1072 ghost = gst_ghost_pad_new("ghostsink", pad); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1073 gst_element_add_pad(bin, ghost); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1074 g_object_set(G_OBJECT(level), "message", TRUE, NULL); |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1075 |
722527dc050f
Implement create_default_audio_* functions in gtkmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26424
diff
changeset
|
1076 return bin; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26164
diff
changeset
|
1077 } |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1078 #endif /* USE_VV */ |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1079 |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1080 void |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1081 pidgin_medias_init(void) |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1082 { |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1083 #ifdef USE_VV |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1084 PurpleMediaManager *manager = purple_media_manager_get(); |
26484
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1085 PurpleMediaElementInfo *default_video_src = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1086 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1087 "id", "pidgindefaultvideosrc", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1088 "name", "Pidgin Default Video Source", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1089 "type", PURPLE_MEDIA_ELEMENT_VIDEO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1090 | PURPLE_MEDIA_ELEMENT_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1091 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1092 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1093 "create-cb", create_default_video_src, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1094 PurpleMediaElementInfo *default_video_sink = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1095 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1096 "id", "pidgindefaultvideosink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1097 "name", "Pidgin Default Video Sink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1098 "type", PURPLE_MEDIA_ELEMENT_VIDEO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1099 | PURPLE_MEDIA_ELEMENT_SINK |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1100 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1101 "create-cb", create_default_video_sink, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1102 PurpleMediaElementInfo *default_audio_src = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1103 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1104 "id", "pidgindefaultaudiosrc", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1105 "name", "Pidgin Default Audio Source", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1106 "type", PURPLE_MEDIA_ELEMENT_AUDIO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1107 | PURPLE_MEDIA_ELEMENT_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1108 | PURPLE_MEDIA_ELEMENT_ONE_SRC |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1109 | PURPLE_MEDIA_ELEMENT_UNIQUE, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1110 "create-cb", create_default_audio_src, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1111 PurpleMediaElementInfo *default_audio_sink = |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1112 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1113 "id", "pidgindefaultaudiosink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1114 "name", "Pidgin Default Audio Sink", |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1115 "type", PURPLE_MEDIA_ELEMENT_AUDIO |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1116 | PURPLE_MEDIA_ELEMENT_SINK |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1117 | PURPLE_MEDIA_ELEMENT_ONE_SINK, |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1118 "create-cb", create_default_audio_sink, NULL); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1119 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1120 g_signal_connect(G_OBJECT(manager), "init-media", |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1121 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
|
1122 |
26473
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1123 purple_media_manager_set_ui_caps(manager, |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1124 PURPLE_MEDIA_CAPS_AUDIO | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1125 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1126 PURPLE_MEDIA_CAPS_VIDEO | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1127 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1128 PURPLE_MEDIA_CAPS_AUDIO_VIDEO); |
24feaf9cfbf1
Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26466
diff
changeset
|
1129 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26161
diff
changeset
|
1130 purple_debug_info("gtkmedia", "Registering media element types\n"); |
26484
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1131 purple_media_manager_set_active_element(manager, default_video_src); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1132 purple_media_manager_set_active_element(manager, default_video_sink); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1133 purple_media_manager_set_active_element(manager, default_audio_src); |
081a819bc710
Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26475
diff
changeset
|
1134 purple_media_manager_set_active_element(manager, default_audio_sink); |
26497
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1135 |
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1136 purple_prefs_add_none("/pidgin/media"); |
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1137 purple_prefs_add_none("/pidgin/media/audio"); |
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1138 purple_prefs_add_none("/pidgin/media/audio/volume"); |
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1139 purple_prefs_add_int("/pidgin/media/audio/volume/input", 10); |
da3f44d6cd52
Change volume preference and make sure it exists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26495
diff
changeset
|
1140 purple_prefs_add_int("/pidgin/media/audio/volume/output", 10); |
26457
0ee10b3e8ee6
Fix compiling with --disable-vv.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26455
diff
changeset
|
1141 #endif |
26145
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1142 } |
685c8f5f85c7
Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26143
diff
changeset
|
1143 |