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