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