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