annotate pidgin/gtkmedia.c @ 25725:64080c01ee50

Decouple stream direction. Allows send only or recv only streams.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sun, 17 Aug 2008 00:49:29 +0000
parents 551a462b346a
children eb289e9086bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file media.c Account API
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup core
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * Pidgin
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * Pidgin is the legal property of its developers, whose names are too numerous
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include <string.h>
25678
1fb16d784ccb Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25674
diff changeset
27 #include "debug.h"
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "internal.h"
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "connection.h"
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "media.h"
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
31 #include "pidgin.h"
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "gtkmedia.h"
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
35 #ifdef USE_VV
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
37 #include <gst/interfaces/xoverlay.h>
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
38
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
39 typedef enum
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
40 {
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
41 /* Waiting for response */
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
42 PIDGIN_MEDIA_WAITING = 1,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
43 /* Got request */
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
44 PIDGIN_MEDIA_REQUESTED,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
45 /* Accepted call */
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
46 PIDGIN_MEDIA_ACCEPTED,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
47 /* Rejected call */
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
48 PIDGIN_MEDIA_REJECTED,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
49 } PidginMediaState;
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
50
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 struct _PidginMediaPrivate
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 PurpleMedia *media;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 GstElement *send_level;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 GstElement *recv_level;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
57 GtkWidget *calling;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 GtkWidget *accept;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 GtkWidget *reject;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 GtkWidget *hangup;
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
61 GtkWidget *mute;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
62
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 GtkWidget *send_progress;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 GtkWidget *recv_progress;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
65
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
66 PidginMediaState state;
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
67
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
68 GtkWidget *display;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
69 GtkWidget *local_video;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
70 GtkWidget *remote_video;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate))
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 static void pidgin_media_class_init (PidginMediaClass *klass);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 static void pidgin_media_init (PidginMedia *media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 static void pidgin_media_finalize (GObject *object);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
80 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 static GtkHBoxClass *parent_class = NULL;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 enum {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 MESSAGE,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 LAST_SIGNAL
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 static guint pidgin_media_signals[LAST_SIGNAL] = {0};
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 enum {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 PROP_0,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 PROP_MEDIA,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 PROP_SEND_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 PROP_RECV_LEVEL
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 GType
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
100 pidgin_media_get_type(void)
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 static GType type = 0;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 if (type == 0) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 static const GTypeInfo info = {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 sizeof(PidginMediaClass),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 (GClassInitFunc) pidgin_media_class_init,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 sizeof(PidginMedia),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 0,
25561
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
114 (GInstanceInitFunc) pidgin_media_init,
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
115 NULL
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 type = g_type_register_static(GTK_TYPE_HBOX, "PidginMedia", &info, 0);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 return type;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 pidgin_media_class_init (PidginMediaClass *klass)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 GObjectClass *gobject_class = (GObjectClass*)klass;
25679
54adcf17d271 Silence warning.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25678
diff changeset
127 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 parent_class = g_type_class_peek_parent(klass);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
129
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 gobject_class->finalize = pidgin_media_finalize;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 gobject_class->set_property = pidgin_media_set_property;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 gobject_class->get_property = pidgin_media_get_property;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 g_object_class_install_property(gobject_class, PROP_MEDIA,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 g_param_spec_object("media",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 "PurpleMedia",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 "The PurpleMedia associated with this media.",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 PURPLE_TYPE_MEDIA,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 g_param_spec_object("send-level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 "Send level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 "The GstElement of this media's send 'level'",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 GST_TYPE_ELEMENT,
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
145 G_PARAM_READWRITE));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147 g_param_spec_object("recv-level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 "Receive level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 "The GstElement of this media's recv 'level'",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 GST_TYPE_ELEMENT,
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
151 G_PARAM_READWRITE));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 pidgin_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 g_cclosure_marshal_VOID__STRING,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 G_TYPE_NONE, 1, G_TYPE_STRING);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 g_type_class_add_private(klass, sizeof(PidginMediaPrivate));
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
161 static void
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
162 pidgin_media_mute_toggled(GtkToggleButton *toggle, PidginMedia *media)
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
163 {
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
164 purple_media_mute(media->priv->media,
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
165 gtk_toggle_button_get_active(toggle));
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
166 }
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 pidgin_media_init (PidginMedia *media)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
172 media->priv->calling = gtk_label_new_with_mnemonic("Calling...");
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 media->priv->hangup = gtk_button_new_with_label("Hangup");
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 media->priv->accept = gtk_button_new_with_label("Accept");
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 media->priv->reject = gtk_button_new_with_label("Reject");
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
176 media->priv->mute = gtk_toggle_button_new_with_label("Mute");
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
177
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
178 g_signal_connect(media->priv->mute, "toggled",
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
179 G_CALLBACK(pidgin_media_mute_toggled), media);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
180
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
181 gtk_box_pack_start(GTK_BOX(media), media->priv->calling, FALSE, FALSE, 0);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 gtk_box_pack_start(GTK_BOX(media), media->priv->hangup, FALSE, FALSE, 0);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 gtk_box_pack_start(GTK_BOX(media), media->priv->accept, FALSE, FALSE, 0);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 gtk_box_pack_start(GTK_BOX(media), media->priv->reject, FALSE, FALSE, 0);
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
185 gtk_box_pack_end(GTK_BOX(media), media->priv->mute, FALSE, FALSE, 0);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
187 gtk_widget_show_all(media->priv->accept);
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
188 gtk_widget_show_all(media->priv->reject);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
189
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
190 media->priv->display = gtk_vbox_new(TRUE, PIDGIN_HIG_BOX_SPACE);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 static gboolean
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 const GstStructure *s;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 const gchar *name;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
199 gdouble rms_db;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
200 gdouble percent;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 const GValue *list;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 const GValue *value;
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
203
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
204 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(message));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 if (message->type != GST_MESSAGE_ELEMENT)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 return TRUE;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 s = gst_message_get_structure(message);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 name = gst_structure_get_name(s);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 if (strcmp(name, "level"))
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 return TRUE;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 list = gst_structure_get_value(s, "rms");
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 /* Only bother with the first channel. */
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 value = gst_value_list_get_value(list, 0);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 rms_db = g_value_get_double(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
221 percent = pow(10, rms_db / 20) * 5;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
222
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
223 if(percent > 1.0)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
224 percent = 1.0;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
225
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 if (!strcmp(gst_element_get_name(src), "sendlevel"))
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
227 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress), percent);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 else
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
229 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress), percent);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 return TRUE;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
234
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
235 static void
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
236 pidgin_media_disconnect_levels(PurpleMedia *media, PidginMedia *gtkmedia)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
237 {
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
238 GstElement *element = purple_media_get_pipeline(media);
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
239 gulong handler_id = g_signal_handler_find(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
240 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
241 NULL, G_CALLBACK(level_message_cb), gtkmedia);
25651
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25647
diff changeset
242 if (handler_id)
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25647
diff changeset
243 g_signal_handler_disconnect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25647
diff changeset
244 handler_id);
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
245 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
246
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
247 static void
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
248 pidgin_media_finalize (GObject *media)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
249 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
250 PidginMedia *gtkmedia = PIDGIN_MEDIA(media);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
251 if (gtkmedia->priv->media) {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
252 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
253 g_object_unref(gtkmedia->priv->media);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
254 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
255 if (gtkmedia->priv->send_level)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
256 gst_object_unref(gtkmedia->priv->send_level);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
257 if (gtkmedia->priv->recv_level)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
258 gst_object_unref(gtkmedia->priv->recv_level);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
259 if (gtkmedia->priv->display)
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
260 gtk_widget_destroy(gtkmedia->priv->display);
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
261 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
262
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
263 static void
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
264 pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
265 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
266 g_signal_emit(gtkmedia, pidgin_media_signals[MESSAGE], 0, msg);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
267 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
268
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
269 GtkWidget *
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
270 pidgin_media_get_display_widget(GtkWidget *gtkmedia)
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
271 {
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
272 return PIDGIN_MEDIA_GET_PRIVATE(gtkmedia)->display;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
273 }
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
274
25678
1fb16d784ccb Listen to the media pipeline and display errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25674
diff changeset
275 static gboolean
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
276 create_window (GstBus *bus, GstMessage *message, PidginMedia *gtkmedia)
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
277 {
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
278 char *name;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
279
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
280 if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_ELEMENT)
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
281 return TRUE;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
282
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
283 if (!gst_structure_has_name(message->structure, "prepare-xwindow-id"))
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
284 return TRUE;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
285
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
286 name = gst_object_get_name(GST_MESSAGE_SRC (message));
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
287 purple_debug_info("gtkmedia", "prepare-xwindow-id object name: %s\n", name);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
288
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
289 /* The XOverlay's name is the sink's name with a suffix */
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
290 if (!strncmp(name, "purplevideosink", strlen("purplevideosink")))
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
291 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)),
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
292 GDK_WINDOW_XWINDOW(gtkmedia->priv->remote_video->window));
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
293 else if (!strncmp(name, "purplelocalvideosink", strlen("purplelocalvideosink")))
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
294 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)),
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
295 GDK_WINDOW_XWINDOW(gtkmedia->priv->local_video->window));
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
296 g_free(name);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
297 return TRUE;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
298 }
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
299
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
303 GstElement *audiosendbin = NULL, *audiosendlevel = NULL;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
304 GstElement *audiorecvbin = NULL, *audiorecvlevel = NULL;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
305 GstElement *videosendbin = NULL;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
306 GstElement *videorecvbin = NULL;
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
307
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
308 GList *sessions = purple_media_get_session_names(media);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
309
25702
a1a1f44cdecc Fixed some memory leak issues involving GLists.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25694
diff changeset
310 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
311 PurpleMediaSessionType type = purple_media_get_session_type(media, sessions->data);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
312 if (type & PURPLE_MEDIA_AUDIO) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
313 if (!audiosendbin && (type & PURPLE_MEDIA_SEND_AUDIO)) {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
314 purple_media_audio_init_src(&audiosendbin, &audiosendlevel);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
315 purple_media_set_src(media, sessions->data, audiosendbin);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
316 gst_element_set_state(audiosendbin, GST_STATE_READY);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
317 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
318 if (!audiorecvbin && (type & PURPLE_MEDIA_RECV_AUDIO)) {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
319 purple_media_audio_init_recv(&audiorecvbin, &audiorecvlevel);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
320 purple_media_set_sink(media, sessions->data, audiorecvbin);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
321 gst_element_set_state(audiorecvbin, GST_STATE_READY);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
322 }
25674
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25671
diff changeset
323 } else if (purple_media_get_session_type(media, sessions->data) & PURPLE_MEDIA_VIDEO) {
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
324 if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
325 purple_media_video_init_src(&videosendbin);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
326 purple_media_set_src(media, sessions->data, videosendbin);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
327 gst_element_set_state(videosendbin, GST_STATE_READY);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
328 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
329 if (!videorecvbin && (type & PURPLE_MEDIA_RECV_VIDEO)) {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
330 purple_media_video_init_recv(&videorecvbin);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
331 purple_media_set_sink(media, sessions->data, videorecvbin);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
332 gst_element_set_state(videorecvbin, GST_STATE_READY);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
333 }
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
334 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
335 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
336
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
337 if (audiosendlevel || audiorecvlevel) {
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
338 g_object_set(gtkmedia, "send-level", audiosendlevel,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
339 "recv-level", audiorecvlevel,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
340 NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
341 }
25694
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
342 }
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
343
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
344 static void
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
345 pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
346 {
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
347 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING);
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
348 }
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
349
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
350 /* maybe we should have different callbacks for when we received the accept
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
351 and we accepted ourselves */
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
352 static void
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
353 pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
354 {
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
355 GtkWidget *send_widget = NULL, *recv_widget = NULL;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
356
25706
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
357 GstElement *pipeline = purple_media_get_pipeline(media);
25694
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
358 GstElement *audiosendbin = NULL;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
359 GstElement *audiorecvbin = NULL;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
360 GstElement *videosendbin = NULL;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
361 GstElement *videorecvbin = NULL;
25706
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
362 GstBus *bus;
25694
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
363
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
364 pidgin_media_emit_message(gtkmedia, _("Call in progress."));
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
365 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
366
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
367 purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
368 &videosendbin, &videorecvbin);
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25693
diff changeset
369
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
370 if (videorecvbin || audiorecvbin) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
371 recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
372 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display),
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
373 recv_widget, TRUE, TRUE, 0);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
374 gtk_widget_show(recv_widget);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
375 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
376 if (videosendbin || audiosendbin) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
377 send_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
378 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display),
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
379 send_widget, TRUE, TRUE, 0);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
380 gtk_widget_show(send_widget);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
381 }
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
382
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
383 if (videorecvbin) {
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
384 GtkWidget *aspect;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
385 GtkWidget *remote_video;
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
386
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
387 aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
388 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
25693
b8e0a56cd6cf Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25692
diff changeset
389 gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
390
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
391 remote_video = gtk_drawing_area_new();
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
392 gtk_container_add(GTK_CONTAINER(aspect), remote_video);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
393 gtk_widget_set_size_request (GTK_WIDGET(remote_video), 100, -1);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
394 gtk_widget_show(remote_video);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
395 gtk_widget_show(aspect);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
396
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
397 gtkmedia->priv->remote_video = remote_video;
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
398 gst_element_set_state(videorecvbin, GST_STATE_PLAYING);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
399 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
400 if (videosendbin) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
401 GtkWidget *aspect;
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
402 GtkWidget *local_video;
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
403
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
404 aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
405 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
25693
b8e0a56cd6cf Fix the order of the send/recv audio/video display widgets.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25692
diff changeset
406 gtk_box_pack_start(GTK_BOX(send_widget), aspect, TRUE, TRUE, 0);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
407
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
408 local_video = gtk_drawing_area_new();
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
409 gtk_container_add(GTK_CONTAINER(aspect), local_video);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
410 gtk_widget_set_size_request (GTK_WIDGET(local_video), 100, -1);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
411 gtk_widget_show(local_video);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
412 gtk_widget_show(aspect);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
413
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
414 gtkmedia->priv->local_video = local_video;
25706
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
415
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
416 gst_element_set_state(videosendbin, GST_STATE_PLAYING);
25686
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
417 }
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
418
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
419 if (audiorecvbin) {
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
420 gtkmedia->priv->recv_progress = gtk_progress_bar_new();
25689
c17d26b6f236 Widened the vertical audio levels.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25688
diff changeset
421 gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 10, 70);
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
422 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress),
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
423 GTK_PROGRESS_BOTTOM_TO_TOP);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
424 gtk_box_pack_end(GTK_BOX(recv_widget),
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
425 gtkmedia->priv->recv_progress, FALSE, FALSE, 0);
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
426 gtk_widget_show(gtkmedia->priv->recv_progress);
25706
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
427 gst_element_set_state(audiorecvbin, GST_STATE_PLAYING);
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
428 }
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
429 if (audiosendbin) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
430 gtkmedia->priv->send_progress = gtk_progress_bar_new();
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
431 gtk_widget_set_size_request(gtkmedia->priv->send_progress, 10, 70);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
432 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->send_progress),
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
433 GTK_PROGRESS_BOTTOM_TO_TOP);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
434 gtk_box_pack_end(GTK_BOX(send_widget),
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
435 gtkmedia->priv->send_progress, FALSE, FALSE, 0);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
436 gtk_widget_show(gtkmedia->priv->send_progress);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
437 gst_element_set_state(audiosendbin, GST_STATE_PLAYING);
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
438 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
439
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
440 if (audiorecvbin || audiosendbin || videorecvbin || videosendbin)
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
441 gtk_widget_show(gtkmedia->priv->display);
25706
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
442
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
443 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
444 if (audiorecvbin || audiosendbin) {
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
445 gst_bus_add_signal_watch(GST_BUS(bus));
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
446 g_signal_connect(G_OBJECT(bus), "message",
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
447 G_CALLBACK(level_message_cb), gtkmedia);
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
448 }
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
449 if (videorecvbin || videosendbin)
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
450 gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia);
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25702
diff changeset
451 gst_object_unref(bus);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 pidgin_media_emit_message(gtkmedia, _("You have ended the call."));
25561
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
458 gtk_widget_destroy(GTK_WIDGET(gtkmedia));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 static void
25687
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
462 pidgin_media_got_request_cb(PurpleMedia *media, PidginMedia *gtkmedia)
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
463 {
25720
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25713
diff changeset
464 PurpleMediaSessionType type = purple_media_get_overall_type(media);
25687
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
465 gchar *message;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
466
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
467 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
468 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
469 purple_media_get_screenname(media));
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
470 } else if (type & PURPLE_MEDIA_AUDIO) {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
471 message = g_strdup_printf(_("%s wishes to start an audio session with you."),
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
472 purple_media_get_screenname(media));
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
473 } else if (type & PURPLE_MEDIA_VIDEO) {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
474 message = g_strdup_printf(_("%s wishes to start a video session with you."),
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
475 purple_media_get_screenname(media));
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
476 } else {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
477 return;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
478 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
479
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
480 pidgin_media_emit_message(gtkmedia, message);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
481 g_free(message);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
482 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
483
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
484 static void
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
485 pidgin_media_got_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
486 {
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
487 pidgin_media_emit_message(gtkmedia, _("The call has been terminated."));
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
488 gtk_widget_destroy(GTK_WIDGET(gtkmedia));
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
489 }
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
490
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
491 static void
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 pidgin_media_reject_cb(PurpleMedia *media, PidginMedia *gtkmedia)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 pidgin_media_emit_message(gtkmedia, _("You have rejected the call."));
25561
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
495 gtk_widget_destroy(GTK_WIDGET(gtkmedia));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 PidginMedia *media;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 g_return_if_fail(PIDGIN_IS_MEDIA(object));
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
503
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 media = PIDGIN_MEDIA(object);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 switch (prop_id) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 case PROP_MEDIA:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 if (media->priv->media)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 g_object_unref(media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 media->priv->media = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 g_object_ref(media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 g_signal_connect_swapped(G_OBJECT(media->priv->accept), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 G_CALLBACK(purple_media_accept), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 g_signal_connect_swapped(G_OBJECT(media->priv->reject), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 G_CALLBACK(purple_media_reject), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 g_signal_connect_swapped(G_OBJECT(media->priv->hangup), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 G_CALLBACK(purple_media_hangup), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
518 g_signal_connect(G_OBJECT(media->priv->media), "accepted",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519 G_CALLBACK(pidgin_media_accept_cb), media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 g_signal_connect(G_OBJECT(media->priv->media) ,"ready",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 G_CALLBACK(pidgin_media_ready_cb), media);
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
522 g_signal_connect(G_OBJECT(media->priv->media) ,"wait",
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
523 G_CALLBACK(pidgin_media_wait_cb), media);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 g_signal_connect(G_OBJECT(media->priv->media), "hangup",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 G_CALLBACK(pidgin_media_hangup_cb), media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 g_signal_connect(G_OBJECT(media->priv->media), "reject",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 G_CALLBACK(pidgin_media_reject_cb), media);
25687
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
528 g_signal_connect(G_OBJECT(media->priv->media), "got-request",
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25686
diff changeset
529 G_CALLBACK(pidgin_media_got_request_cb), media);
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
530 g_signal_connect(G_OBJECT(media->priv->media), "got-hangup",
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
531 G_CALLBACK(pidgin_media_got_hangup_cb), media);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
532 g_signal_connect(G_OBJECT(media->priv->media), "got-accept",
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
533 G_CALLBACK(pidgin_media_accept_cb), media);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 case PROP_SEND_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 if (media->priv->send_level)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
537 gst_object_unref(media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 media->priv->send_level = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 g_object_ref(media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
540 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 case PROP_RECV_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 if (media->priv->recv_level)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 gst_object_unref(media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 media->priv->recv_level = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545 g_object_ref(media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
546 break;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
547 default:
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
548 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
549 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
550 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 PidginMedia *media;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 g_return_if_fail(PIDGIN_IS_MEDIA(object));
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
558
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
559 media = PIDGIN_MEDIA(object);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
560
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 switch (prop_id) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 case PROP_MEDIA:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 g_value_set_object(value, media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 case PROP_SEND_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 g_value_set_object(value, media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 case PROP_RECV_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 g_value_set_object(value, media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 break;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
571 default:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
572 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 GtkWidget *
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
578 pidgin_media_new(PurpleMedia *media)
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
579 {
25671
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
580 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25654
diff changeset
581 "media", media, NULL);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
582 return GTK_WIDGET(gtkmedia);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
583 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
584
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
585 static void
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
586 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state)
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 {
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
588 gtkmedia->priv->state = state;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
589 switch (state) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
590 case PIDGIN_MEDIA_WAITING:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
591 gtk_widget_show(gtkmedia->priv->calling);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
592 gtk_widget_hide(gtkmedia->priv->accept);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
593 gtk_widget_hide(gtkmedia->priv->reject);
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
594 gtk_widget_show(gtkmedia->priv->hangup);
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
595 gtk_widget_hide(gtkmedia->priv->mute);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
596 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
597 case PIDGIN_MEDIA_REQUESTED:
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
598 gtk_widget_hide(gtkmedia->priv->calling);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
599 gtk_widget_show(gtkmedia->priv->accept);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
600 gtk_widget_show(gtkmedia->priv->reject);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
601 gtk_widget_hide(gtkmedia->priv->hangup);
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
602 gtk_widget_hide(gtkmedia->priv->mute);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
603 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
604 case PIDGIN_MEDIA_ACCEPTED:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
605 gtk_widget_show(gtkmedia->priv->hangup);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
606 gtk_widget_hide(gtkmedia->priv->calling);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
607 gtk_widget_hide(gtkmedia->priv->accept);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
608 gtk_widget_hide(gtkmedia->priv->reject);
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
609 gtk_widget_show(gtkmedia->priv->mute);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
610 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
611 default:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
612 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
613 }
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
616 #endif /* USE_VV */