annotate pidgin/gtkmedia.c @ 26135:c334a9e17426

Wait to create the sinks until the frames are ready. This should hopefully be the end of the BadWindow errors.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Mon, 19 Jan 2009 10:44:07 +0000
parents 6eeb500ce9a2
children f6a98b2b8d92
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;
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
54 gchar *screenname;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55 GstElement *send_level;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 GstElement *recv_level;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
58 GtkWidget *calling;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 GtkWidget *accept;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 GtkWidget *reject;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 GtkWidget *hangup;
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
62 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
63
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 GtkWidget *send_progress;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 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
66
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
67 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
68
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 *display;
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
70 GtkWidget *send_widget;
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
71 GtkWidget *recv_widget;
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
72 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
73 GtkWidget *remote_video;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 #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
77
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 static void pidgin_media_class_init (PidginMediaClass *klass);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 static void pidgin_media_init (PidginMedia *media);
26087
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
80 static void pidgin_media_dispose (GObject *object);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 static void pidgin_media_finalize (GObject *object);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 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
83 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
84 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 static GtkHBoxClass *parent_class = NULL;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 enum {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 MESSAGE,
26058
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
92 ERROR,
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 LAST_SIGNAL
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 static guint pidgin_media_signals[LAST_SIGNAL] = {0};
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 enum {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 PROP_0,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 PROP_MEDIA,
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
100 PROP_SCREENNAME,
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 PROP_SEND_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 PROP_RECV_LEVEL
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 };
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 GType
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
106 pidgin_media_get_type(void)
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 static GType type = 0;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 if (type == 0) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 static const GTypeInfo info = {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 sizeof(PidginMediaClass),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 (GClassInitFunc) pidgin_media_class_init,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 sizeof(PidginMedia),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 0,
25561
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
120 (GInstanceInitFunc) pidgin_media_init,
1ec6a26cfefc Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25550
diff changeset
121 NULL
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 };
26130
525aa65805b9 Rearrange the Pidgin media GUI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
123 type = g_type_register_static(GTK_TYPE_VBOX, "PidginMedia", &info, 0);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 return type;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 pidgin_media_class_init (PidginMediaClass *klass)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 GObjectClass *gobject_class = (GObjectClass*)klass;
25679
54adcf17d271 Silence warning.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25678
diff changeset
133 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 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
135
26087
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
136 gobject_class->dispose = pidgin_media_dispose;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 gobject_class->finalize = pidgin_media_finalize;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 gobject_class->set_property = pidgin_media_set_property;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 gobject_class->get_property = pidgin_media_get_property;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 g_object_class_install_property(gobject_class, PROP_MEDIA,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 g_param_spec_object("media",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 "PurpleMedia",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 "The PurpleMedia associated with this media.",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 PURPLE_TYPE_MEDIA,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
147 g_object_class_install_property(gobject_class, PROP_SCREENNAME,
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
148 g_param_spec_string("screenname",
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
149 "Screenname",
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
150 "The screenname of the user this session is with.",
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
151 NULL,
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
152 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 g_object_class_install_property(gobject_class, PROP_SEND_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 g_param_spec_object("send-level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 "Send level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 "The GstElement of this media's send 'level'",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 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
158 G_PARAM_READWRITE));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 g_object_class_install_property(gobject_class, PROP_RECV_LEVEL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 g_param_spec_object("recv-level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 "Receive level",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 "The GstElement of this media's recv 'level'",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 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
164 G_PARAM_READWRITE));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 pidgin_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass),
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 g_cclosure_marshal_VOID__STRING,
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 G_TYPE_NONE, 1, G_TYPE_STRING);
26058
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
170 pidgin_media_signals[ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
171 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
172 g_cclosure_marshal_VOID__STRING,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
173 G_TYPE_NONE, 1, G_TYPE_STRING);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 g_type_class_add_private(klass, sizeof(PidginMediaPrivate));
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
178 static void
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
179 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
180 {
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
181 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
182 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
183 }
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 pidgin_media_init (PidginMedia *media)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media);
26034
6260a6192166 Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26027
diff changeset
189 media->priv->calling = gtk_label_new("Calling...");
6260a6192166 Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26027
diff changeset
190 media->priv->hangup = gtk_button_new_with_mnemonic("_Hangup");
6260a6192166 Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26027
diff changeset
191 media->priv->accept = gtk_button_new_with_mnemonic("_Accept");
6260a6192166 Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26027
diff changeset
192 media->priv->reject = gtk_button_new_with_mnemonic("_Reject");
6260a6192166 Add mnemonics to buttons in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26027
diff changeset
193 media->priv->mute = gtk_toggle_button_new_with_mnemonic("_Mute");
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
194
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
195 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
196 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
197
26130
525aa65805b9 Rearrange the Pidgin media GUI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
198 gtk_box_pack_end(GTK_BOX(media), media->priv->reject, FALSE, FALSE, 0);
525aa65805b9 Rearrange the Pidgin media GUI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
199 gtk_box_pack_end(GTK_BOX(media), media->priv->accept, FALSE, FALSE, 0);
525aa65805b9 Rearrange the Pidgin media GUI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
200 gtk_box_pack_end(GTK_BOX(media), media->priv->hangup, FALSE, FALSE, 0);
25713
4eae2d40f11b Added a mute button for the local microphone.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25706
diff changeset
201 gtk_box_pack_end(GTK_BOX(media), media->priv->mute, FALSE, FALSE, 0);
26130
525aa65805b9 Rearrange the Pidgin media GUI.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
202 gtk_box_pack_end(GTK_BOX(media), media->priv->calling, FALSE, FALSE, 0);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
204 gtk_widget_show_all(media->priv->accept);
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
205 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
206
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
207 media->priv->display = gtk_vbox_new(TRUE, PIDGIN_HIG_BOX_SPACE);
26131
6eeb500ce9a2 Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26130
diff changeset
208 gtk_box_pack_start(GTK_BOX(media), media->priv->display,
6eeb500ce9a2 Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26130
diff changeset
209 TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 static gboolean
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 level_message_cb(GstBus *bus, GstMessage *message, PidginMedia *gtkmedia)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 const GstStructure *s;
25728
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25726
diff changeset
216 gchar *name;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
218 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
219 gdouble percent;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 const GValue *list;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 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
222
25647
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
223 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(message));
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 if (message->type != GST_MESSAGE_ELEMENT)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 return TRUE;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 s = gst_message_get_structure(message);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229
25728
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25726
diff changeset
230 if (strcmp(gst_structure_get_name(s), "level"))
25550
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 list = gst_structure_get_value(s, "rms");
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 /* Only bother with the first channel. */
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 value = gst_value_list_get_value(list, 0);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 rms_db = g_value_get_double(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
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 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
240
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
241 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
242 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
243
25728
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25726
diff changeset
244 name = gst_element_get_name(src);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25726
diff changeset
245 if (!strcmp(name, "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
246 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
247 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
248 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
249
25728
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25726
diff changeset
250 g_free(name);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 return TRUE;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
25647
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 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
256 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
257 {
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
258 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
259 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
260 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
261 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
262 if (handler_id)
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25647
diff changeset
263 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
264 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
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
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
267 static void
26087
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
268 pidgin_media_dispose(GObject *media)
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
269 {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
270 PidginMedia *gtkmedia = PIDGIN_MEDIA(media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
271 purple_debug_info("gtkmedia", "pidgin_media_dispose\n");
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
272
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
273 if (gtkmedia->priv->media) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
274 GstElement *videosendbin = NULL, *videorecvbin = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
275
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
276 purple_media_get_elements(gtkmedia->priv->media, NULL, NULL,
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
277 &videosendbin, &videorecvbin);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
278
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
279 if (videorecvbin) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
280 gst_element_set_locked_state(videorecvbin, TRUE);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
281 gst_element_set_state(videorecvbin, GST_STATE_NULL);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
282 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
283 if (videosendbin) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
284 gst_element_set_locked_state(videosendbin, TRUE);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
285 gst_element_set_state(videosendbin, GST_STATE_NULL);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
286 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
287
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
288 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
289 g_object_unref(gtkmedia->priv->media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
290 gtkmedia->priv->media = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
291 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
292
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
293 if (gtkmedia->priv->send_level) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
294 gst_object_unref(gtkmedia->priv->send_level);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
295 gtkmedia->priv->send_level = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
296 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
297
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
298 if (gtkmedia->priv->recv_level) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
299 gst_object_unref(gtkmedia->priv->recv_level);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
300 gtkmedia->priv->recv_level = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
301 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
302
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
303 G_OBJECT_CLASS(parent_class)->dispose(media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
304 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
305
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
306 static void
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
307 pidgin_media_finalize(GObject *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
308 {
26131
6eeb500ce9a2 Remove unneeded pidgin_media_get_display_widget function.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26130
diff changeset
309 /* PidginMedia *gtkmedia = PIDGIN_MEDIA(media); */
26014
bd598b606ca4 Restructure Jingle code to more easily support multiple application types.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26013
diff changeset
310 purple_debug_info("gtkmedia", "pidgin_media_finalize\n");
26087
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
311
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
312 G_OBJECT_CLASS(parent_class)->finalize(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
313 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
314
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
315 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
316 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
317 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
318 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
319 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25643
diff changeset
320
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
321 typedef struct
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
322 {
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
323 PidginMedia *gtkmedia;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
324 gchar *session_id;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
325 gchar *participant;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
326 } PidginMediaRealizeData;
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
327
26107
4859b0b82289 Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26089
diff changeset
328 static gboolean
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
329 realize_cb_cb(PidginMediaRealizeData *data)
26107
4859b0b82289 Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26089
diff changeset
330 {
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
331 PidginMediaPrivate *priv = data->gtkmedia->priv;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
332 gulong window_id;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
333
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
334 if (data->participant == NULL)
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
335 window_id = GDK_WINDOW_XWINDOW(priv->local_video->window);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
336 else
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
337 window_id = GDK_WINDOW_XWINDOW(priv->remote_video->window);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
338
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
339 purple_media_set_output_window(priv->media, data->session_id,
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
340 data->participant, window_id);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
341
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
342 g_free(data->session_id);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
343 g_free(data->participant);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
344 g_free(data);
26107
4859b0b82289 Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26089
diff changeset
345 return FALSE;
4859b0b82289 Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26089
diff changeset
346 }
4859b0b82289 Hopefully stop the last of the BadWindow errors.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26089
diff changeset
347
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 static void
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
349 realize_cb(GtkWidget *widget, PidginMediaRealizeData *data)
26053
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
350 {
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
351 g_timeout_add(0, (GSourceFunc)realize_cb_cb, data);
26053
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
352 }
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
353
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
354 static void
26058
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
355 pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia)
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
356 {
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
357 g_signal_emit(gtkmedia, pidgin_media_signals[ERROR], 0, error);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
358 }
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
359
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
360 static gboolean
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
361 plug_delete_event_cb(GtkWidget *widget, gpointer data)
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
362 {
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
363 return TRUE;
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
364 }
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
365
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
366 static gboolean
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
367 plug_removed_cb(GtkWidget *widget, gpointer data)
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
368 {
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
369 return TRUE;
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
370 }
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
371
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
372 static void
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
373 socket_realize_cb(GtkWidget *widget, gpointer data)
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
374 {
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
375 gtk_socket_add_id(GTK_SOCKET(widget),
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
376 gtk_plug_get_id(GTK_PLUG(data)));
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
377 }
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
378
26058
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
379 static void
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
380 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid)
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 {
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
382 GstElement *pipeline = purple_media_get_pipeline(media);
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
383 GtkWidget *send_widget = NULL, *recv_widget = NULL;
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 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
385 GstElement *videosendbin = NULL;
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
386 gboolean audiorecvbool = FALSE;
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
387 gboolean videorecvbool = FALSE;
26117
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
388 gboolean is_initiator;
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
389
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
390 PurpleMediaSessionType type = purple_media_get_session_type(media, sid);
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
391 if (type & PURPLE_MEDIA_AUDIO) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
392 if (!audiosendbin && (type & PURPLE_MEDIA_SEND_AUDIO)) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
393 purple_media_audio_init_src(&audiosendbin, &audiosendlevel);
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
394 purple_media_set_src(media, sid, audiosendbin);
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
395 gst_element_set_state(audiosendbin, GST_STATE_PLAYING);
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
396 }
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
397 if (!audiorecvbool && (type & PURPLE_MEDIA_RECV_AUDIO)) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
398 audiorecvbool = TRUE;
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
399 }
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
400 } else if (type & PURPLE_MEDIA_VIDEO) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
401 if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
402 purple_media_video_init_src(&videosendbin);
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
403 purple_media_set_src(media, sid, videosendbin);
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
404 gst_element_set_state(videosendbin, GST_STATE_PLAYING);
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
405 }
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
406 if (!videorecvbool && (type & PURPLE_MEDIA_RECV_VIDEO)) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
407 videorecvbool = TRUE;
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
408 }
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
409 }
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
410
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
411 if (gtkmedia->priv->recv_widget == NULL
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
412 && (videorecvbool || audiorecvbool)) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
413 recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
414 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
415 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
416 gtk_widget_show(recv_widget);
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
417 } else
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
418 recv_widget = gtkmedia->priv->recv_widget;
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
419 if (gtkmedia->priv->send_widget == NULL
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
420 && (videosendbin || audiosendbin)) {
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
421 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
422 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
423 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
424 gtk_widget_show(send_widget);
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
425 } else
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
426 send_widget = gtkmedia->priv->send_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
427
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
428 if (videorecvbool) {
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
429 PidginMediaRealizeData *data;
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
430 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
431 GtkWidget *remote_video;
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
432 GtkWidget *plug;
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
433 GtkWidget *socket;
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
434
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
435 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
436 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
437 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
438
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
439 plug = gtk_plug_new(0);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
440 g_signal_connect(G_OBJECT(plug), "delete-event",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
441 G_CALLBACK(plug_delete_event_cb), plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
442 gtk_widget_show(plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
443
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
444 socket = gtk_socket_new();
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
445 g_signal_connect(G_OBJECT(socket), "realize",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
446 G_CALLBACK(socket_realize_cb), plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
447 g_signal_connect(G_OBJECT(socket), "plug-removed",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
448 G_CALLBACK(plug_removed_cb), NULL);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
449 gtk_container_add(GTK_CONTAINER(aspect), socket);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
450 gtk_widget_show(socket);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
451
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
452 data = g_new0(PidginMediaRealizeData, 1);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
453 data->gtkmedia = gtkmedia;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
454 data->session_id = g_strdup(sid);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
455 data->participant = g_strdup(gtkmedia->priv->screenname);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
456
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
457 remote_video = gtk_drawing_area_new();
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
458 g_signal_connect(G_OBJECT(remote_video), "realize",
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
459 G_CALLBACK(realize_cb), data);
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
460 gtk_container_add(GTK_CONTAINER(plug), remote_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
461 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
462 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
463 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
464
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
465 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
466 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
467 if (videosendbin) {
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
468 PidginMediaRealizeData *data;
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
469 GtkWidget *aspect;
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
470 GtkWidget *local_video;
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
471 GtkWidget *plug;
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
472 GtkWidget *socket;
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
473
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
474 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
475 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
476 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
477
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
478 plug = gtk_plug_new(0);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
479 g_signal_connect(G_OBJECT(plug), "delete-event",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
480 G_CALLBACK(plug_delete_event_cb), plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
481 gtk_widget_show(plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
482
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
483 socket = gtk_socket_new();
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
484 g_signal_connect(G_OBJECT(socket), "realize",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
485 G_CALLBACK(socket_realize_cb), plug);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
486 g_signal_connect(G_OBJECT(socket), "plug-removed",
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
487 G_CALLBACK(plug_removed_cb), NULL);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
488 gtk_container_add(GTK_CONTAINER(aspect), socket);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
489 gtk_widget_show(socket);
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
490
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
491 data = g_new0(PidginMediaRealizeData, 1);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
492 data->gtkmedia = gtkmedia;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
493 data->session_id = g_strdup(sid);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
494 data->participant = NULL;
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
495
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
496 local_video = gtk_drawing_area_new();
26053
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
497 g_signal_connect(G_OBJECT(local_video), "realize",
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
498 G_CALLBACK(realize_cb), data);
26089
6c8eabbef4d3 Fix crash when moving a tab with video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26087
diff changeset
499 gtk_container_add(GTK_CONTAINER(plug), local_video);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
500 gtk_widget_set_size_request (GTK_WIDGET(local_video), 100, -1);
26053
99c3489e06b0 Wait for local video frame to be realized before starting local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26034
diff changeset
501
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
502 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
503 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
504
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
505 gtkmedia->priv->local_video = 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
506 }
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25679
diff changeset
507
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
508 if (audiorecvbool) {
25688
9c6915254610 Move the audio progress bar widgets to be beside the video displays.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25687
diff changeset
509 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
510 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
511 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
512 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
513 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
514 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
515 gtk_widget_show(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
516 }
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
517 if (audiosendbin) {
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
518 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
519 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
520 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
521 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
522 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
523 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
524 gtk_widget_show(gtkmedia->priv->send_progress);
25726
eb289e9086bf Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25725
diff changeset
525
eb289e9086bf Only show the mute button when sending an audio stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25725
diff changeset
526 gtk_widget_show(gtkmedia->priv->mute);
25725
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
527 }
64080c01ee50 Decouple stream direction. Allows send only or recv only streams.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25720
diff changeset
528
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
529
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
530 if (audiorecvbool || audiosendbin) {
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
531 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
532 g_signal_connect(G_OBJECT(bus), "message::element",
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
533 G_CALLBACK(level_message_cb), gtkmedia);
26135
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
534 gst_object_unref(bus);
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26131
diff changeset
535 }
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
536
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
537 if (send_widget != NULL)
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
538 gtkmedia->priv->send_widget = send_widget;
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
539 if (recv_widget != NULL)
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
540 gtkmedia->priv->recv_widget = recv_widget;
26027
94224a5563db Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26014
diff changeset
541
26117
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
542 g_object_get(G_OBJECT(media), "initiator", &is_initiator, NULL);
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
543
26117
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
544 if (is_initiator == FALSE) {
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
545 gchar *message;
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
546 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
547 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
548 gtkmedia->priv->screenname);
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
549 } else if (type & PURPLE_MEDIA_AUDIO) {
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
550 message = g_strdup_printf(_("%s wishes to start an audio session with you."),
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
551 gtkmedia->priv->screenname);
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
552 } else if (type & PURPLE_MEDIA_VIDEO) {
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
553 message = g_strdup_printf(_("%s wishes to start a video session with you."),
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
554 gtkmedia->priv->screenname);
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
555 }
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
556 pidgin_media_emit_message(gtkmedia, message);
958a5d614f71 Replace the got-request signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26116
diff changeset
557 g_free(message);
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
558 }
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
559 }
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
560
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
561 static void
26114
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
562 pidgin_media_state_changed_cb(PurpleMedia *media,
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
563 PurpleMediaStateChangedType type,
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
564 gchar *sid, gchar *name, PidginMedia *gtkmedia)
25634
741a702033e0 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25561
diff changeset
565 {
26114
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
566 purple_debug_info("gtkmedia", "type: %d sid: %s name: %s\n",
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
567 type, sid, name);
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
568 if (sid == NULL && name == NULL) {
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
569 if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
570 pidgin_media_emit_message(gtkmedia,
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
571 _("The call has been terminated."));
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
572 gtk_widget_destroy(GTK_WIDGET(gtkmedia));
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
573
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
574 } else if (type == PURPLE_MEDIA_STATE_CHANGED_REJECTED) {
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
575 pidgin_media_emit_message(gtkmedia,
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
576 _("You have rejected the call."));
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
577 }
26116
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
578 } else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW &&
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
579 sid != NULL && name != NULL) {
3b82059e4069 Replace the ready signal in PidginMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
580 pidgin_media_ready_cb(media, gtkmedia, sid);
26115
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
581 } else if (type == PURPLE_MEDIA_STATE_CHANGED_CONNECTED) {
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
582 GstElement *audiosendbin = NULL, *audiorecvbin = NULL;
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
583 GstElement *videosendbin = NULL, *videorecvbin = NULL;
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
584
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
585 pidgin_media_emit_message(gtkmedia, _("Call in progress."));
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
586 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
587
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
588 purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
589 &videosendbin, &videorecvbin);
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
590
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
591 if (audiorecvbin || audiosendbin || videorecvbin || videosendbin)
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
592 gtk_widget_show(gtkmedia->priv->display);
26114
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
593 }
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 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
598 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 PidginMedia *media;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 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
601
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 media = PIDGIN_MEDIA(object);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 switch (prop_id) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 case PROP_MEDIA:
26115
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
605 {
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
606 gboolean initiator;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 if (media->priv->media)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 g_object_unref(media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 media->priv->media = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 g_object_ref(media->priv->media);
26115
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
611
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
612 g_object_get(G_OBJECT(media->priv->media),
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
613 "initiator", &initiator, NULL);
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
614 if (initiator == TRUE)
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
615 pidgin_media_set_state(media, PIDGIN_MEDIA_WAITING);
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
616 else
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
617 pidgin_media_set_state(media, PIDGIN_MEDIA_REQUESTED);
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
618
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 g_signal_connect_swapped(G_OBJECT(media->priv->accept), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 G_CALLBACK(purple_media_accept), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 g_signal_connect_swapped(G_OBJECT(media->priv->reject), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 G_CALLBACK(purple_media_reject), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 g_signal_connect_swapped(G_OBJECT(media->priv->hangup), "clicked",
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 G_CALLBACK(purple_media_hangup), media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625
26058
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
626 g_signal_connect(G_OBJECT(media->priv->media), "error",
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26053
diff changeset
627 G_CALLBACK(pidgin_media_error_cb), media);
26114
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
628 g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
2809a63dbadf Convert PidginMedia to use the state-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26108
diff changeset
629 G_CALLBACK(pidgin_media_state_changed_cb), media);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 break;
26115
366f68124622 Convert more PidginMedia signals to the newer API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
631 }
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
632 case PROP_SCREENNAME:
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
633 if (media->priv->screenname)
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
634 g_free(media->priv->screenname);
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
635 media->priv->screenname = g_value_dup_string(value);
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
636 break;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 case PROP_SEND_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 if (media->priv->send_level)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 gst_object_unref(media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 media->priv->send_level = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 g_object_ref(media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 case PROP_RECV_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 if (media->priv->recv_level)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 gst_object_unref(media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 media->priv->recv_level = g_value_get_object(value);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 g_object_ref(media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 break;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
649 default:
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 static void
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
656 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
657 {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
658 PidginMedia *media;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
659 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
660
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 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
662
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 switch (prop_id) {
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 case PROP_MEDIA:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665 g_value_set_object(value, media->priv->media);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 break;
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
667 case PROP_SCREENNAME:
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
668 g_value_set_string(value, media->priv->screenname);
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
669 break;
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 case PROP_SEND_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 g_value_set_object(value, media->priv->send_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 case PROP_RECV_LEVEL:
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 g_value_set_object(value, media->priv->recv_level);
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 break;
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
676 default:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
677 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 break;
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 GtkWidget *
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
683 pidgin_media_new(PurpleMedia *media, const gchar *screenname)
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
684 {
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
685 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(),
26060
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
686 "media", media,
0829a08038c6 Remove the screenname attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
687 "screenname", screenname, NULL);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
688 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
689 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
690
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
691 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
692 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state)
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693 {
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
694 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
695 switch (state) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
696 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
697 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
698 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
699 gtk_widget_hide(gtkmedia->priv->reject);
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
700 gtk_widget_show(gtkmedia->priv->hangup);
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
701 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
702 case PIDGIN_MEDIA_REQUESTED:
25643
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25637
diff changeset
703 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
704 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
705 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
706 gtk_widget_hide(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
707 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
708 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
709 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
710 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
711 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
712 gtk_widget_hide(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
713 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
714 default:
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
715 break;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25634
diff changeset
716 }
25550
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
8067ba21fdd0 Missing files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
25654
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 25651
diff changeset
719 #endif /* USE_VV */