Wed, 01 Apr 2009 01:05:03 +0000
Use purple_media_manager_get_pipeline instead.
| 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" | |
|
26479
47511dae9f81
Move GStreamer related media functions into its own header.
Michael Ruprecht <maiku@pidgin.im>
parents:
26463
diff
changeset
|
31 | #include "media-gst.h" |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
32 | #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
|
33 | #include "pidgin.h" |
|
26273
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
34 | #include "request.h" |
| 19886 | 35 | |
| 36 | #include "gtkmedia.h" | |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
37 | #include "gtkutils.h" |
| 19886 | 38 | |
|
23704
9b88c9b23aed
Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents:
23701
diff
changeset
|
39 | #ifdef USE_VV |
| 19886 | 40 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
41 | #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
|
42 | |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
43 | #define PIDGIN_TYPE_MEDIA (pidgin_media_get_type()) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
44 | #define PIDGIN_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_MEDIA, PidginMedia)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
45 | #define PIDGIN_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
46 | #define PIDGIN_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_MEDIA)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
47 | #define PIDGIN_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_MEDIA)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
48 | #define PIDGIN_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_MEDIA, PidginMediaClass)) |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
49 | |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
50 | typedef struct _PidginMedia PidginMedia; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
51 | typedef struct _PidginMediaClass PidginMediaClass; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
52 | typedef struct _PidginMediaPrivate PidginMediaPrivate; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
53 | |
|
22682
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
54 | typedef enum |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
55 | { |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
56 | /* Waiting for response */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
57 | PIDGIN_MEDIA_WAITING = 1, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
58 | /* Got request */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
59 | PIDGIN_MEDIA_REQUESTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
60 | /* Accepted call */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
61 | PIDGIN_MEDIA_ACCEPTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
62 | /* Rejected call */ |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
63 | PIDGIN_MEDIA_REJECTED, |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
64 | } PidginMediaState; |
|
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
65 | |
|
26503
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
66 | struct _PidginMediaClass |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
67 | { |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
68 | GtkWindowClass parent_class; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
69 | }; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
70 | |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
71 | struct _PidginMedia |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
72 | { |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
73 | GtkWindow parent; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
74 | PidginMediaPrivate *priv; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
75 | }; |
|
8f0ab2bd6cf3
Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents:
26502
diff
changeset
|
76 | |
| 19886 | 77 | struct _PidginMediaPrivate |
| 78 | { | |
| 79 | PurpleMedia *media; | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
80 | gchar *screenname; |
| 19886 | 81 | GstElement *send_level; |
| 82 | GstElement *recv_level; | |
| 83 | ||
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
84 | GtkItemFactory *item_factory; |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
85 | GtkWidget *menubar; |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
86 | GtkWidget *statusbar; |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
87 | |
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
88 | 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
|
89 | |
| 19886 | 90 | GtkWidget *send_progress; |
| 91 | 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
|
92 | |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
93 | 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
|
94 | |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
95 | GtkWidget *display; |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
96 | GtkWidget *send_widget; |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
97 | 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
|
98 | 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
|
99 | GtkWidget *remote_video; |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
100 | PurpleConnection *pc; |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
101 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
102 | guint timeout_id; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
103 | PurpleMediaSessionType request_type; |
| 19886 | 104 | }; |
| 105 | ||
| 106 | #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate)) | |
| 107 | ||
| 108 | static void pidgin_media_class_init (PidginMediaClass *klass); | |
| 109 | static void pidgin_media_init (PidginMedia *media); | |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
110 | static void pidgin_media_dispose (GObject *object); |
| 19886 | 111 | static void pidgin_media_finalize (GObject *object); |
| 112 | static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); | |
| 113 | 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
|
114 | static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state); |
| 19886 | 115 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
116 | static GtkWindowClass *parent_class = NULL; |
| 19886 | 117 | |
| 118 | ||
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
119 | #if 0 |
| 19886 | 120 | enum { |
| 121 | LAST_SIGNAL | |
| 122 | }; | |
| 123 | static guint pidgin_media_signals[LAST_SIGNAL] = {0}; | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
124 | #endif |
| 19886 | 125 | |
| 126 | enum { | |
| 127 | PROP_0, | |
| 128 | PROP_MEDIA, | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
129 | PROP_SCREENNAME, |
| 19886 | 130 | PROP_SEND_LEVEL, |
| 131 | PROP_RECV_LEVEL | |
| 132 | }; | |
| 133 | ||
| 26509 | 134 | static GType |
|
22400
3762d64b1f58
Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22072
diff
changeset
|
135 | pidgin_media_get_type(void) |
| 19886 | 136 | { |
| 137 | static GType type = 0; | |
| 138 | ||
| 139 | if (type == 0) { | |
| 140 | static const GTypeInfo info = { | |
| 141 | sizeof(PidginMediaClass), | |
| 142 | NULL, | |
| 143 | NULL, | |
| 144 | (GClassInitFunc) pidgin_media_class_init, | |
| 145 | NULL, | |
| 146 | NULL, | |
| 147 | sizeof(PidginMedia), | |
| 148 | 0, | |
|
22072
4ad1e1e6d94e
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19886
diff
changeset
|
149 | (GInstanceInitFunc) pidgin_media_init, |
|
4ad1e1e6d94e
Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19886
diff
changeset
|
150 | NULL |
| 19886 | 151 | }; |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
152 | type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0); |
| 19886 | 153 | } |
| 154 | return type; | |
| 155 | } | |
| 156 | ||
| 157 | ||
| 158 | static void | |
| 159 | pidgin_media_class_init (PidginMediaClass *klass) | |
| 160 | { | |
| 161 | GObjectClass *gobject_class = (GObjectClass*)klass; | |
| 23729 | 162 | /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */ |
| 19886 | 163 | 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
|
164 | |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
165 | gobject_class->dispose = pidgin_media_dispose; |
| 19886 | 166 | gobject_class->finalize = pidgin_media_finalize; |
| 167 | gobject_class->set_property = pidgin_media_set_property; | |
| 168 | gobject_class->get_property = pidgin_media_get_property; | |
| 169 | ||
| 170 | g_object_class_install_property(gobject_class, PROP_MEDIA, | |
| 171 | g_param_spec_object("media", | |
| 172 | "PurpleMedia", | |
| 173 | "The PurpleMedia associated with this media.", | |
| 174 | PURPLE_TYPE_MEDIA, | |
| 175 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
176 | 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
|
177 | g_param_spec_string("screenname", |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
178 | "Screenname", |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
179 | "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
|
180 | NULL, |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
181 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
| 19886 | 182 | g_object_class_install_property(gobject_class, PROP_SEND_LEVEL, |
| 183 | g_param_spec_object("send-level", | |
| 184 | "Send level", | |
| 185 | "The GstElement of this media's send 'level'", | |
| 186 | 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
|
187 | G_PARAM_READWRITE)); |
| 19886 | 188 | g_object_class_install_property(gobject_class, PROP_RECV_LEVEL, |
| 189 | g_param_spec_object("recv-level", | |
| 190 | "Receive level", | |
| 191 | "The GstElement of this media's recv 'level'", | |
| 192 | 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
|
193 | G_PARAM_READWRITE)); |
| 19886 | 194 | |
| 195 | g_type_class_add_private(klass, sizeof(PidginMediaPrivate)); | |
| 196 | } | |
| 197 | ||
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
198 | static void |
|
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
199 | 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
|
200 | { |
|
26502
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
201 | purple_media_stream_info(media->priv->media, |
|
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
202 | gtk_toggle_button_get_active(toggle) ? |
|
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
203 | PURPLE_MEDIA_INFO_MUTE : PURPLE_MEDIA_INFO_UNMUTE, |
|
f0c8338ca7da
Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents:
26501
diff
changeset
|
204 | NULL, NULL, TRUE); |
|
26103
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
205 | } |
| 19886 | 206 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
207 | static gboolean |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
208 | pidgin_media_delete_event_cb(GtkWidget *widget, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
209 | GdkEvent *event, PidginMedia *media) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
210 | { |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
211 | if (media->priv->media) |
|
26499
759bf410db86
Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents:
26496
diff
changeset
|
212 | purple_media_stream_info(media->priv->media, |
|
759bf410db86
Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents:
26496
diff
changeset
|
213 | PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
214 | return FALSE; |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
215 | } |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
216 | |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
217 | static int |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
218 | 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
|
219 | { |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
220 | 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
|
221 | 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
|
222 | #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
|
223 | XERRORCASE(BadAccess); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
224 | XERRORCASE(BadAlloc); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
225 | XERRORCASE(BadAtom); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
226 | XERRORCASE(BadColor); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
227 | XERRORCASE(BadCursor); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
228 | XERRORCASE(BadDrawable); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
229 | XERRORCASE(BadFont); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
230 | XERRORCASE(BadGC); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
231 | XERRORCASE(BadIDChoice); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
232 | XERRORCASE(BadImplementation); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
233 | XERRORCASE(BadLength); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
234 | XERRORCASE(BadMatch); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
235 | XERRORCASE(BadName); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
236 | XERRORCASE(BadPixmap); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
237 | XERRORCASE(BadRequest); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
238 | XERRORCASE(BadValue); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
239 | XERRORCASE(BadWindow); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
240 | #undef XERRORCASE |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
241 | default: |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
242 | error_type = "unknown"; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
243 | break; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
244 | } |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
245 | 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
|
246 | "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
|
247 | error_type); |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
248 | return 0; |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
249 | } |
|
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
250 | |
| 19886 | 251 | static void |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
252 | 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
|
253 | { |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
254 | PidginMedia *gtkmedia = PIDGIN_MEDIA(data); |
|
26499
759bf410db86
Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents:
26496
diff
changeset
|
255 | purple_media_stream_info(gtkmedia->priv->media, |
|
759bf410db86
Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents:
26496
diff
changeset
|
256 | PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE); |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
257 | } |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
258 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
259 | static GtkItemFactoryEntry menu_items[] = { |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
260 | { 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
|
261 | { 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
|
262 | }; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
263 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
264 | 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
|
265 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
266 | static const char * |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
267 | 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
|
268 | { |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
269 | return _(path); |
|
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 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
272 | static GtkWidget * |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
273 | setup_menubar(PidginMedia *window) |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
274 | { |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
275 | GtkAccelGroup *accel_group; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
276 | GtkWidget *menu; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
277 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
278 | accel_group = gtk_accel_group_new (); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
279 | 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
|
280 | g_object_unref(accel_group); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
281 | |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
282 | 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
|
283 | "<main>", accel_group); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
284 | |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
285 | 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
|
286 | (GtkTranslateFunc)item_factory_translate_func, |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
287 | NULL, NULL); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
288 | |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
294 | 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
|
295 | window->priv->item_factory, "<main>"); |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
296 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
297 | gtk_widget_show(menu); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
298 | return menu; |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
299 | } |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
300 | |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
301 | static void |
| 19886 | 302 | pidgin_media_init (PidginMedia *media) |
| 303 | { | |
|
26271
85e58eb8479c
Change the media window items' orientations to look better.
Michael Ruprecht <maiku@pidgin.im>
parents:
26270
diff
changeset
|
304 | GtkWidget *vbox, *hbox; |
| 19886 | 305 | media->priv = PIDGIN_MEDIA_GET_PRIVATE(media); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
306 | |
|
26283
196caad2294d
Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents:
26282
diff
changeset
|
307 | 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
|
308 | |
|
26481
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
309 | vbox = gtk_vbox_new(FALSE, 0); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
310 | gtk_container_add(GTK_CONTAINER(media), vbox); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
311 | |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
312 | media->priv->statusbar = gtk_statusbar_new(); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
313 | 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
|
314 | FALSE, FALSE, 0); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
315 | 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
|
316 | 0, _("Calling...")); |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
317 | gtk_widget_show(media->priv->statusbar); |
|
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
318 | |
|
26298
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
319 | media->priv->menubar = setup_menubar(media); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
320 | 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
|
321 | FALSE, TRUE, 0); |
|
ca30f1c77069
Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26289
diff
changeset
|
322 | |
|
26271
85e58eb8479c
Change the media window items' orientations to look better.
Michael Ruprecht <maiku@pidgin.im>
parents:
26270
diff
changeset
|
323 | 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
|
324 | 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
|
325 | 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
|
326 | |
|
26158
3c52c0332696
Add mnemonics to buttons in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26151
diff
changeset
|
327 | 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
|
328 | |
|
1cdefa229226
Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents:
26096
diff
changeset
|
329 | 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
|
330 | 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
|
331 | |
|
26271
85e58eb8479c
Change the media window items' orientations to look better.
Michael Ruprecht <maiku@pidgin.im>
parents:
26270
diff
changeset
|
332 | gtk_box_pack_end(GTK_BOX(hbox), media->priv->mute, FALSE, FALSE, 0); |
|
26481
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
333 | gtk_container_set_border_width(GTK_CONTAINER(media->priv->mute), |
|
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
334 | PIDGIN_HIG_BOX_SPACE); |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
335 | |
|
26284
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
336 | media->priv->display = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
|
26481
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
337 | gtk_container_set_border_width(GTK_CONTAINER(media->priv->display), |
|
c5813c3ae985
Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26479
diff
changeset
|
338 | PIDGIN_HIG_BOX_SPACE); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
339 | 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
|
340 | TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
341 | gtk_widget_show(vbox); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
342 | |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
343 | g_signal_connect(G_OBJECT(media), "delete-event", |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
344 | G_CALLBACK(pidgin_media_delete_event_cb), media); |
| 19886 | 345 | } |
| 346 | ||
| 347 | static gboolean | |
| 348 | level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia) | |
| 349 | { | |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
350 | 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
|
351 | gdouble percent; |
| 19886 | 352 | const GValue *list; |
| 353 | 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
|
354 | |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
355 | 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
|
356 | GtkWidget *progress; |
| 19886 | 357 | |
| 358 | if (message->type != GST_MESSAGE_ELEMENT) | |
| 359 | return TRUE; | |
| 360 | ||
| 26439 | 361 | if (!gst_structure_has_name( |
|
26276
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
362 | gst_message_get_structure(message), "level")) |
| 19886 | 363 | return TRUE; |
| 364 | ||
|
26276
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
365 | if (src == gtkmedia->priv->send_level) |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
366 | progress = gtkmedia->priv->send_progress; |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
367 | 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
|
368 | progress = gtkmedia->priv->recv_progress; |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
369 | else |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
370 | return TRUE; |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
371 | |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
372 | list = gst_structure_get_value( |
|
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
373 | gst_message_get_structure(message), "rms"); |
| 19886 | 374 | |
| 375 | /* Only bother with the first channel. */ | |
| 376 | value = gst_value_list_get_value(list, 0); | |
| 377 | rms_db = g_value_get_double(value); | |
| 378 | ||
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
379 | 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
|
380 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
381 | 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
|
382 | 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
|
383 | |
|
26276
b9d3887b8318
Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents:
26275
diff
changeset
|
384 | gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), percent); |
| 19886 | 385 | return TRUE; |
| 386 | } | |
| 387 | ||
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
388 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
389 | static void |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
390 | 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
|
391 | { |
|
26523
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
392 | PurpleMediaManager *manager = purple_media_get_manager(media); |
|
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
393 | GstElement *element = purple_media_manager_get_pipeline(manager); |
|
23697
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
394 | 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
|
395 | 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
|
396 | 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
|
397 | if (handler_id) |
|
ecbd92b724df
Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents:
23697
diff
changeset
|
398 | 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
|
399 | 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
|
400 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
401 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
402 | static void |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
403 | pidgin_media_dispose(GObject *media) |
|
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 | PidginMedia *gtkmedia = PIDGIN_MEDIA(media); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
406 | purple_debug_info("gtkmedia", "pidgin_media_dispose\n"); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
407 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
408 | 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
|
409 | 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
|
410 | purple_media_remove_output_windows(gtkmedia->priv->media); |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
411 | pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
412 | g_object_unref(gtkmedia->priv->media); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
413 | gtkmedia->priv->media = NULL; |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
414 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
415 | |
|
26305
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
416 | 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
|
417 | 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
|
418 | 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
|
419 | } |
|
04b0dd0fd8cb
Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents:
26298
diff
changeset
|
420 | |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
421 | if (gtkmedia->priv->send_level) { |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
422 | gst_object_unref(gtkmedia->priv->send_level); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
423 | gtkmedia->priv->send_level = NULL; |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
424 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
425 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
426 | if (gtkmedia->priv->recv_level) { |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
427 | gst_object_unref(gtkmedia->priv->recv_level); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
428 | gtkmedia->priv->recv_level = NULL; |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
429 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
430 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
431 | G_OBJECT_CLASS(parent_class)->dispose(media); |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
432 | } |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
433 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
434 | static void |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
435 | 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
|
436 | { |
|
26255
3b0da2f49570
Remove unneeded pidgin_media_get_display_widget function.
Michael Ruprecht <maiku@pidgin.im>
parents:
26254
diff
changeset
|
437 | /* 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
|
438 | purple_debug_info("gtkmedia", "pidgin_media_finalize\n"); |
|
26210
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
439 | |
|
dffd522ea21e
Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents:
26184
diff
changeset
|
440 | 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
|
441 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
442 | |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
443 | static void |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
444 | 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
|
445 | { |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
446 | PurpleConversation *conv = purple_find_conversation_with_account( |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
447 | PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
448 | purple_connection_get_account(gtkmedia->priv->pc)); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
449 | if (conv != NULL) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
450 | purple_conversation_write(conv, NULL, msg, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
451 | 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
|
452 | } |
|
299bafcd8eb8
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents:
22682
diff
changeset
|
453 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
454 | 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
|
455 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
456 | PidginMedia *gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
457 | gchar *session_id; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
458 | gchar *participant; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
459 | } 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
|
460 | |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
461 | static gboolean |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
462 | realize_cb_cb(PidginMediaRealizeData *data) |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
463 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
464 | 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
|
465 | gulong window_id; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
466 | |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
467 | if (data->participant == NULL) |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
468 | 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
|
469 | else |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
470 | 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
|
471 | |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
472 | 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
|
473 | data->participant, window_id); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
474 | |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
475 | 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
|
476 | g_free(data->participant); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
477 | g_free(data); |
|
26233
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
478 | return FALSE; |
|
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
479 | } |
|
236de657aae4
Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents:
26212
diff
changeset
|
480 | |
| 19886 | 481 | static void |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
482 | 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
|
483 | { |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
484 | 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
|
485 | } |
|
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
486 | |
|
35f25555116f
Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26158
diff
changeset
|
487 | static void |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
488 | 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
|
489 | { |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
490 | PurpleConversation *conv = purple_find_conversation_with_account( |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
491 | PURPLE_CONV_TYPE_ANY, gtkmedia->priv->screenname, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
492 | purple_connection_get_account(gtkmedia->priv->pc)); |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
493 | if (conv != NULL) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
494 | purple_conversation_write(conv, NULL, error, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
495 | PURPLE_MESSAGE_ERROR, time(NULL)); |
|
26285
da0d636d494a
Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents:
26284
diff
changeset
|
496 | 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
|
497 | 0, error); |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
498 | } |
|
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
499 | |
|
26267
3bd0240f0632
Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26259
diff
changeset
|
500 | static void |
|
3bd0240f0632
Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26259
diff
changeset
|
501 | 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
|
502 | 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
|
503 | { |
|
3bd0240f0632
Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26259
diff
changeset
|
504 | 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
|
505 | 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
|
506 | 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
|
507 | 0, _("Call in progress.")); |
|
26273
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
508 | 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
|
509 | } |
|
3bd0240f0632
Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26259
diff
changeset
|
510 | |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
511 | static gboolean |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
512 | 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
|
513 | { |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
514 | return TRUE; |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
515 | } |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
516 | |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
517 | static gboolean |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
518 | 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
|
519 | { |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
520 | return TRUE; |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
521 | } |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
522 | |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
523 | static void |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
524 | 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
|
525 | { |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
526 | 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
|
527 | 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
|
528 | } |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
529 | |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
530 | static void |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
531 | pidgin_media_accept_cb(PurpleMedia *media, int index) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
532 | { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
533 | purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
534 | NULL, NULL, TRUE); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
535 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
536 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
537 | static void |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
538 | pidgin_media_reject_cb(PurpleMedia *media, int index) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
539 | { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
540 | purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
541 | NULL, NULL, TRUE); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
542 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
543 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
544 | static gboolean |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
545 | pidgin_request_timeout_cb(PidginMedia *gtkmedia) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
546 | { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
547 | PurpleConnection *pc; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
548 | PurpleBuddy *buddy; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
549 | const gchar *alias; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
550 | PurpleMediaSessionType type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
551 | gchar *message = NULL; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
552 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
553 | pc = purple_media_get_connection(gtkmedia->priv->media); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
554 | buddy = purple_find_buddy(purple_connection_get_account(pc), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
555 | gtkmedia->priv->screenname); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
556 | alias = buddy ? purple_buddy_get_contact_alias(buddy) : |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
557 | gtkmedia->priv->screenname; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
558 | type = gtkmedia->priv->request_type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
559 | gtkmedia->priv->timeout_id = 0; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
560 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
561 | if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
562 | message = g_strdup_printf(_("%s wishes to start an audio/video session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
563 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
564 | } else if (type & PURPLE_MEDIA_AUDIO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
565 | message = g_strdup_printf(_("%s wishes to start an audio session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
566 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
567 | } else if (type & PURPLE_MEDIA_VIDEO) { |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
568 | message = g_strdup_printf(_("%s wishes to start a video session with you."), |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
569 | alias); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
570 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
571 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
572 | gtkmedia->priv->request_type = PURPLE_MEDIA_NONE; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
573 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
574 | purple_request_accept_cancel(gtkmedia, "Media invitation", |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
575 | message, NULL, PURPLE_DEFAULT_ACTION_NONE, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
576 | (void*)pc, gtkmedia->priv->screenname, NULL, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
577 | gtkmedia->priv->media, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
578 | pidgin_media_accept_cb, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
579 | pidgin_media_reject_cb); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
580 | pidgin_media_emit_message(gtkmedia, message); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
581 | g_free(message); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
582 | return FALSE; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
583 | } |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
584 | |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
585 | static void |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
586 | pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid) |
| 19886 | 587 | { |
|
26523
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
588 | PurpleMediaManager *manager = purple_media_get_manager(media); |
|
4544b079e3dd
Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents:
26522
diff
changeset
|
589 | GstElement *pipeline = purple_media_manager_get_pipeline(manager); |
|
26151
218a4f61cf0d
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
590 | GtkWidget *send_widget = NULL, *recv_widget = NULL; |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
591 | PurpleMediaSessionType type = |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
592 | 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
|
593 | |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
594 | if (gtkmedia->priv->recv_widget == NULL |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
595 | && type & (PURPLE_MEDIA_RECV_VIDEO | |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
596 | PURPLE_MEDIA_RECV_AUDIO)) { |
|
26271
85e58eb8479c
Change the media window items' orientations to look better.
Michael Ruprecht <maiku@pidgin.im>
parents:
26270
diff
changeset
|
597 | 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
|
598 | 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
|
599 | 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
|
600 | gtk_widget_show(recv_widget); |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
601 | } else |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
602 | recv_widget = gtkmedia->priv->recv_widget; |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
603 | if (gtkmedia->priv->send_widget == NULL |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
604 | && type & (PURPLE_MEDIA_SEND_VIDEO | |
|
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
605 | PURPLE_MEDIA_SEND_AUDIO)) { |
|
26271
85e58eb8479c
Change the media window items' orientations to look better.
Michael Ruprecht <maiku@pidgin.im>
parents:
26270
diff
changeset
|
606 | 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
|
607 | 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
|
608 | 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
|
609 | gtk_widget_show(send_widget); |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
610 | } else |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
611 | 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
|
612 | |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
613 | 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
|
614 | 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
|
615 | 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
|
616 | GtkWidget *remote_video; |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
617 | GtkWidget *plug; |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
618 | 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
|
619 | 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
|
620 | |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
621 | 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
|
622 | 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
|
623 | 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
|
624 | |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
625 | plug = gtk_plug_new(0); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
626 | 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
|
627 | 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
|
628 | gtk_widget_show(plug); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
629 | |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
630 | socket = gtk_socket_new(); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
631 | 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
|
632 | G_CALLBACK(socket_realize_cb), plug); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
633 | 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
|
634 | G_CALLBACK(plug_removed_cb), NULL); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
635 | 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
|
636 | gtk_widget_show(socket); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
637 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
638 | 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
|
639 | data->gtkmedia = gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
640 | 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
|
641 | 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
|
642 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | G_CALLBACK(realize_cb), data); |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
647 | 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
|
648 | 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
|
649 | 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
|
650 | 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
|
651 | |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
652 | 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
|
653 | } |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
654 | 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
|
655 | PidginMediaRealizeData *data; |
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
656 | GtkWidget *aspect; |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
657 | GtkWidget *local_video; |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
658 | GtkWidget *plug; |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
659 | 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
|
660 | 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
|
661 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
666 | plug = gtk_plug_new(0); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
667 | 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
|
668 | 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
|
669 | gtk_widget_show(plug); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
670 | |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
671 | socket = gtk_socket_new(); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
672 | 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
|
673 | G_CALLBACK(socket_realize_cb), plug); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
674 | 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
|
675 | G_CALLBACK(plug_removed_cb), NULL); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
676 | 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
|
677 | gtk_widget_show(socket); |
|
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
678 | |
|
26259
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
679 | 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
|
680 | data->gtkmedia = gtkmedia; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
681 | 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
|
682 | data->participant = NULL; |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
683 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
684 | 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
|
685 | 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
|
686 | 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
|
687 | G_CALLBACK(realize_cb), data); |
|
26212
39c28f0ab920
Fix crash when moving a tab with video.
Michael Ruprecht <maiku@pidgin.im>
parents:
26210
diff
changeset
|
688 | 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
|
689 | 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
|
690 | |
|
23736
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
691 | 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
|
692 | 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
|
693 | |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
694 | 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
|
695 | } |
|
e77595cce169
Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents:
23729
diff
changeset
|
696 | |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
697 | 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
|
698 | 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
|
699 | 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
|
700 | 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
|
701 | 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
|
702 | 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
|
703 | } |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
704 | if (type & PURPLE_MEDIA_SEND_AUDIO) { |
| 26439 | 705 | GstElement *media_src = purple_media_get_src(media, sid); |
| 706 | gtkmedia->priv->send_level = gst_bin_get_by_name( | |
| 707 | GST_BIN(media_src), "sendlevel"); | |
| 708 | ||
|
26113
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
709 | 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
|
710 | 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
|
711 | 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
|
712 | 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
|
713 | 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
|
714 | |
|
9a48f9ebf100
Only show the mute button when sending an audio stream.
Michael Ruprecht <maiku@pidgin.im>
parents:
26113
diff
changeset
|
715 | 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
|
716 | } |
|
ad871f934f18
Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents:
26108
diff
changeset
|
717 | |
|
26151
218a4f61cf0d
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
718 | |
|
26270
c92c7e4eb004
Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26269
diff
changeset
|
719 | 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
|
720 | 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
|
721 | 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
|
722 | 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
|
723 | gst_object_unref(bus); |
|
0983517fc75f
Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents:
26255
diff
changeset
|
724 | } |
|
26151
218a4f61cf0d
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents:
26143
diff
changeset
|
725 | |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
726 | if (send_widget != NULL) |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
727 | gtkmedia->priv->send_widget = send_widget; |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
728 | if (recv_widget != NULL) |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
729 | 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
|
730 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
731 | if (purple_media_is_initiator(media, sid, NULL) == FALSE) { |
|
26512
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
732 | if (gtkmedia->priv->timeout_id != 0) |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
733 | g_source_remove(gtkmedia->priv->timeout_id); |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
734 | gtkmedia->priv->request_type |= type; |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
735 | gtkmedia->priv->timeout_id = g_timeout_add(500, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
736 | (GSourceFunc)pidgin_request_timeout_cb, |
|
0a10f7f30fd6
Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents:
26510
diff
changeset
|
737 | gtkmedia); |
|
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
|
738 | } |
|
26284
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
739 | |
|
5d36c99b8f2d
Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents:
26283
diff
changeset
|
740 | 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
|
741 | } |
|
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
742 | |
|
91165a8fcbd9
Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents:
23736
diff
changeset
|
743 | static void |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
744 | pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state, |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
745 | 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
|
746 | { |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
747 | purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n", |
|
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
748 | state, sid, name); |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
749 | if (sid == NULL && name == NULL) { |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
750 | if (state == PURPLE_MEDIA_STATE_END) { |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
751 | pidgin_media_emit_message(gtkmedia, |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
752 | _("The call has been terminated.")); |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
753 | gtk_widget_destroy(GTK_WIDGET(gtkmedia)); |
|
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
754 | } |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
755 | } else if (state == PURPLE_MEDIA_STATE_NEW && |
|
26242
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
756 | sid != NULL && name != NULL) { |
|
4e3c5480ef0f
Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26241
diff
changeset
|
757 | pidgin_media_ready_cb(media, gtkmedia, sid); |
|
26449
9e381dc6ed24
Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents:
26444
diff
changeset
|
758 | } else if (state == PURPLE_MEDIA_STATE_CONNECTED && |
| 26439 | 759 | purple_media_get_session_type(media, sid) & |
| 760 | PURPLE_MEDIA_RECV_AUDIO) { | |
|
26457
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
761 | GstElement *tee = purple_media_get_tee(media, sid, name); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
762 | GstIterator *iter = gst_element_iterate_src_pads(tee); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
763 | GstPad *sinkpad; |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
764 | if (gst_iterator_next(iter, (gpointer)&sinkpad) |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
765 | == GST_ITERATOR_OK) { |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
766 | GstPad *peer = gst_pad_get_peer(sinkpad); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
767 | if (peer != NULL) { |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
768 | gtkmedia->priv->recv_level = |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
769 | gst_bin_get_by_name( |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
770 | GST_BIN(GST_OBJECT_PARENT( |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
771 | peer)), "recvlevel"); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
772 | gst_object_unref(peer); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
773 | } |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
774 | gst_object_unref(sinkpad); |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
775 | } |
|
26d452a76b31
Use purple_media_get_tee instead of purple_media_get_sink.
Michael Ruprecht <maiku@pidgin.im>
parents:
26449
diff
changeset
|
776 | gst_iterator_free(iter); |
|
26240
3bc5338843aa
Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26234
diff
changeset
|
777 | } |
| 19886 | 778 | } |
| 779 | ||
| 780 | static void | |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
781 | pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type, |
|
26496
11e1e5221460
Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26494
diff
changeset
|
782 | gchar *sid, gchar *name, gboolean local, |
|
11e1e5221460
Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents:
26494
diff
changeset
|
783 | PidginMedia *gtkmedia) |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
784 | { |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
785 | if (type == PURPLE_MEDIA_INFO_REJECT) { |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
786 | pidgin_media_emit_message(gtkmedia, |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
787 | _("You have rejected the call.")); |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
788 | } |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
789 | } |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
790 | |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
791 | static void |
| 19886 | 792 | pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
| 793 | { | |
| 794 | PidginMedia *media; | |
| 795 | 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
|
796 | |
| 19886 | 797 | media = PIDGIN_MEDIA(object); |
| 798 | switch (prop_id) { | |
| 799 | case PROP_MEDIA: | |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
800 | { |
| 19886 | 801 | if (media->priv->media) |
| 802 | g_object_unref(media->priv->media); | |
| 803 | media->priv->media = g_value_get_object(value); | |
| 804 | 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
|
805 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
806 | if (purple_media_is_initiator(media->priv->media, |
|
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
807 | NULL, NULL) == TRUE) |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
808 | 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
|
809 | else |
|
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
810 | 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
|
811 | |
|
26182
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
812 | g_signal_connect(G_OBJECT(media->priv->media), "error", |
|
728ad1da9cbc
Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents:
26177
diff
changeset
|
813 | 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
|
814 | 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
|
815 | 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
|
816 | 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
|
817 | G_CALLBACK(pidgin_media_state_changed_cb), media); |
|
26444
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
818 | g_signal_connect(G_OBJECT(media->priv->media), "stream-info", |
|
55d385e7faad
Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents:
26439
diff
changeset
|
819 | G_CALLBACK(pidgin_media_stream_info_cb), media); |
| 19886 | 820 | break; |
|
26241
d4be7f79d6bc
Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26240
diff
changeset
|
821 | } |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
822 | case PROP_SCREENNAME: |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
823 | if (media->priv->screenname) |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
824 | g_free(media->priv->screenname); |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
825 | media->priv->screenname = g_value_dup_string(value); |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
826 | break; |
| 19886 | 827 | case PROP_SEND_LEVEL: |
| 828 | if (media->priv->send_level) | |
| 829 | gst_object_unref(media->priv->send_level); | |
| 830 | media->priv->send_level = g_value_get_object(value); | |
| 831 | g_object_ref(media->priv->send_level); | |
| 832 | break; | |
| 833 | case PROP_RECV_LEVEL: | |
| 834 | if (media->priv->recv_level) | |
| 835 | gst_object_unref(media->priv->recv_level); | |
| 836 | media->priv->recv_level = g_value_get_object(value); | |
| 837 | g_object_ref(media->priv->recv_level); | |
| 838 | break; | |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
839 | default: |
| 19886 | 840 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 841 | break; | |
| 842 | } | |
| 843 | } | |
| 844 | ||
| 845 | static void | |
| 846 | pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) | |
| 847 | { | |
| 848 | PidginMedia *media; | |
| 849 | 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
|
850 | |
| 19886 | 851 | 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
|
852 | |
| 19886 | 853 | switch (prop_id) { |
| 854 | case PROP_MEDIA: | |
| 855 | g_value_set_object(value, media->priv->media); | |
| 856 | break; | |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
857 | case PROP_SCREENNAME: |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
858 | g_value_set_string(value, media->priv->screenname); |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
859 | break; |
| 19886 | 860 | case PROP_SEND_LEVEL: |
| 861 | g_value_set_object(value, media->priv->send_level); | |
| 862 | break; | |
| 863 | case PROP_RECV_LEVEL: | |
| 864 | g_value_set_object(value, media->priv->recv_level); | |
| 865 | break; | |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
866 | default: |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
867 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
| 19886 | 868 | break; |
| 869 | } | |
| 870 | } | |
| 871 | ||
|
26494
829997fe9c23
No reason for this to be public API.
Michael Ruprecht <maiku@pidgin.im>
parents:
26488
diff
changeset
|
872 | static GtkWidget * |
|
26184
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
873 | 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
|
874 | { |
|
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
|
875 | 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
|
876 | "media", media, |
|
db732f8c4d29
Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents:
26182
diff
changeset
|
877 | "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
|
878 | 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
|
879 | } |
|
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
880 | |
|
22682
8df904a56d77
Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22648
diff
changeset
|
881 | 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
|
882 | pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state) |
| 19886 | 883 | { |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22400
diff
changeset
|
884 | gtkmedia->priv->state = state; |
| 19886 | 885 | } |
| 886 | ||
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
887 | static gboolean |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
888 | pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media, |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
889 | PurpleConnection *pc, gchar *screenname, gpointer nul) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
890 | { |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
891 | PidginMedia *gtkmedia = PIDGIN_MEDIA( |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
892 | pidgin_media_new(media, screenname)); |
|
26275
69951c5ca44f
Use aliases for the media window title and the request window.
Michael Ruprecht <maiku@pidgin.im>
parents:
26273
diff
changeset
|
893 | 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
|
894 | 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
|
895 | 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
|
896 | purple_buddy_get_contact_alias(buddy) : screenname; |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
897 | 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
|
898 | gtk_window_set_title(GTK_WINDOW(gtkmedia), alias); |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
899 | |
|
26514
058053cffc0e
Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents:
26512
diff
changeset
|
900 | if (purple_media_is_initiator(media, NULL, NULL) == TRUE) |
|
26273
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
901 | gtk_widget_show(GTK_WIDGET(gtkmedia)); |
|
34eb5919488a
Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26272
diff
changeset
|
902 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
903 | return TRUE; |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
904 | } |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
905 | |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
906 | static GstElement * |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
907 | create_default_video_src(PurpleMedia *media, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
908 | const gchar *session_id, const gchar *participant) |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
909 | { |
|
26462
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
910 | GstElement *sendbin, *src, *videoscale, *capsfilter; |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
911 | GstPad *pad; |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
912 | GstPad *ghost; |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
913 | GstCaps *caps; |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
914 | const gchar *video_plugin = purple_prefs_get_string( |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
915 | "/purple/media/video/plugin"); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
916 | const gchar *video_device = purple_prefs_get_string( |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
917 | "/purple/media/video/device"); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
918 | |
|
26507
629bdcfe9516
Unique elements ought to be named the same as their id.
Michael Ruprecht <maiku@pidgin.im>
parents:
26504
diff
changeset
|
919 | sendbin = gst_bin_new("pidgindefaultvideosrc"); |
|
26462
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
920 | src = gst_element_factory_make(video_plugin, "purplevideosource"); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
921 | videoscale = gst_element_factory_make("videoscale", NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
922 | capsfilter = gst_element_factory_make("capsfilter", NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
923 | |
|
26487
d4e09b87e92f
Extend the range for video dimensions just a hair.
Michael Ruprecht <maiku@pidgin.im>
parents:
26481
diff
changeset
|
924 | /* It was recommended to set the size <= 352x288 and framerate <= 20 */ |
|
d4e09b87e92f
Extend the range for video dimensions just a hair.
Michael Ruprecht <maiku@pidgin.im>
parents:
26481
diff
changeset
|
925 | caps = gst_caps_from_string("video/x-raw-yuv , width=[250,352] , " |
|
d4e09b87e92f
Extend the range for video dimensions just a hair.
Michael Ruprecht <maiku@pidgin.im>
parents:
26481
diff
changeset
|
926 | "height=[200,288] , framerate=[10/1,20/1]"); |
|
26462
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
927 | g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
928 | |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
929 | gst_bin_add_many(GST_BIN(sendbin), src, |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
930 | videoscale, capsfilter, NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
931 | gst_element_link_many(src, videoscale, capsfilter, NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
932 | |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
933 | if (!strcmp(video_plugin, "videotestsrc")) { |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
934 | /* Set is-live to true to throttle videotestsrc */ |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
935 | g_object_set (G_OBJECT(src), "is-live", TRUE, NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
936 | } |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
937 | |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
938 | pad = gst_element_get_static_pad(capsfilter, "src"); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
939 | ghost = gst_ghost_pad_new("ghostsrc", pad); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
940 | gst_object_unref(pad); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
941 | gst_element_add_pad(sendbin, ghost); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
942 | |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
943 | if (video_device != NULL && strcmp(video_device, "")) |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
944 | g_object_set(G_OBJECT(src), "device", video_device, NULL); |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
945 | |
|
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
946 | return sendbin; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
947 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
948 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
949 | static GstElement * |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
950 | create_default_video_sink(PurpleMedia *media, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
951 | const gchar *session_id, const gchar *participant) |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
952 | { |
|
26462
78777290e568
Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26457
diff
changeset
|
953 | return gst_element_factory_make("autovideosink", NULL); |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
954 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
955 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
956 | static GstElement * |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
957 | create_default_audio_src(PurpleMedia *media, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
958 | const gchar *session_id, const gchar *participant) |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
959 | { |
|
26463
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
960 | GstElement *bin, *src, *volume, *level; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
961 | GstPad *pad, *ghost; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
962 | const gchar *audio_device = purple_prefs_get_string( |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
963 | "/purple/media/audio/device"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
964 | double input_volume = purple_prefs_get_int( |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
965 | "/purple/media/audio/volume/input")/10.0; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
966 | |
|
26507
629bdcfe9516
Unique elements ought to be named the same as their id.
Michael Ruprecht <maiku@pidgin.im>
parents:
26504
diff
changeset
|
967 | bin = gst_bin_new("pidgindefaultaudiosrc"); |
|
26463
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
968 | src = gst_element_factory_make("alsasrc", "asrc"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
969 | volume = gst_element_factory_make("volume", "purpleaudioinputvolume"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
970 | g_object_set(volume, "volume", input_volume, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
971 | level = gst_element_factory_make("level", "sendlevel"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
972 | gst_bin_add_many(GST_BIN(bin), src, volume, level, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
973 | gst_element_link(src, volume); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
974 | gst_element_link(volume, level); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
975 | pad = gst_element_get_pad(level, "src"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
976 | ghost = gst_ghost_pad_new("ghostsrc", pad); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
977 | gst_element_add_pad(bin, ghost); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
978 | g_object_set(G_OBJECT(level), "message", TRUE, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
979 | |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
980 | if (audio_device != NULL && strcmp(audio_device, "")) |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
981 | g_object_set(G_OBJECT(src), "device", audio_device, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
982 | |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
983 | return bin; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
984 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
985 | |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
986 | static GstElement * |
|
26522
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
987 | create_default_audio_sink(PurpleMedia *media, |
|
44401eba59a5
Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents:
26521
diff
changeset
|
988 | const gchar *session_id, const gchar *participant) |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
989 | { |
|
26463
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
990 | GstElement *bin, *sink, *volume, *level, *queue; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
991 | GstPad *pad, *ghost; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
992 | double output_volume = purple_prefs_get_int( |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
993 | "/purple/media/audio/volume/output")/10.0; |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
994 | |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
995 | bin = gst_bin_new("pidginrecvaudiobin"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
996 | sink = gst_element_factory_make("alsasink", "asink"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
997 | volume = gst_element_factory_make("volume", "purpleaudiooutputvolume"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
998 | g_object_set(volume, "volume", output_volume, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
999 | level = gst_element_factory_make("level", "recvlevel"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1000 | queue = gst_element_factory_make("queue", NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1001 | gst_bin_add_many(GST_BIN(bin), sink, volume, level, queue, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1002 | gst_element_link(level, sink); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1003 | gst_element_link(volume, level); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1004 | gst_element_link(queue, volume); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1005 | pad = gst_element_get_pad(queue, "sink"); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1006 | ghost = gst_ghost_pad_new("ghostsink", pad); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1007 | gst_element_add_pad(bin, ghost); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1008 | g_object_set(G_OBJECT(level), "message", TRUE, NULL); |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1009 | |
|
9bc796a6c87a
Implement create_default_audio_* functions in gtkmedia.c.
Michael Ruprecht <maiku@pidgin.im>
parents:
26462
diff
changeset
|
1010 | return bin; |
|
26289
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
1011 | } |
|
1d832b48fa58
Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents:
26288
diff
changeset
|
1012 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1013 | 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
|
1014 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1015 | "pidgindefaultvideosrc", /* id */ |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1016 | 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
|
1017 | | PURPLE_MEDIA_ELEMENT_SRC |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1018 | | PURPLE_MEDIA_ELEMENT_ONE_SRC |
|
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1019 | | 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
|
1020 | 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
|
1021 | }; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1022 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1023 | 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
|
1024 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1025 | "pidgindefaultvideosink", /* id */ |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1026 | 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
|
1027 | | PURPLE_MEDIA_ELEMENT_SINK |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1028 | | 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
|
1029 | 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
|
1030 | }; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1031 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1032 | 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
|
1033 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1034 | "pidgindefaultaudiosrc", /* id */ |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1035 | 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
|
1036 | | PURPLE_MEDIA_ELEMENT_SRC |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1037 | | PURPLE_MEDIA_ELEMENT_ONE_SRC |
|
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1038 | | 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
|
1039 | 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
|
1040 | }; |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1041 | |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1042 | 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
|
1043 | { |
|
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1044 | "pidgindefaultaudiosink", /* id */ |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1045 | 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
|
1046 | | PURPLE_MEDIA_ELEMENT_SINK |
|
26288
f845c1ee3b03
Added PurpleMediaElementType enum and added type to PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents:
26287
diff
changeset
|
1047 | | 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
|
1048 | 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
|
1049 | }; |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1050 | #endif /* USE_VV */ |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1051 | |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1052 | void |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1053 | pidgin_medias_init(void) |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1054 | { |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1055 | #ifdef USE_VV |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1056 | 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
|
1057 | g_signal_connect(G_OBJECT(manager), "init-media", |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1058 | 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
|
1059 | |
|
26521
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1060 | purple_media_manager_set_ui_caps(manager, |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1061 | PURPLE_MEDIA_CAPS_AUDIO | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1062 | PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1063 | PURPLE_MEDIA_CAPS_VIDEO | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1064 | PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION | |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1065 | PURPLE_MEDIA_CAPS_AUDIO_VIDEO); |
|
f7f083e8cd31
Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents:
26514
diff
changeset
|
1066 | |
|
26287
c0cdd840a828
Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents:
26285
diff
changeset
|
1067 | 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
|
1068 | 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
|
1069 | 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
|
1070 | 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
|
1071 | purple_media_manager_set_active_element(manager, &default_audio_sink); |
|
26504
55082249a5f9
Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents:
26503
diff
changeset
|
1072 | #endif |
|
26269
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1073 | } |
|
cacc598079e4
Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents:
26267
diff
changeset
|
1074 |