pidgin/gtkmedia.c

Tue, 16 Feb 2016 18:37:01 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Tue, 16 Feb 2016 18:37:01 -0600
changeset 37575
32611080681c
parent 37424
04cf8cbe44d8
child 37589
e498a88e7c00
permissions
-rw-r--r--

Cleanup the plugin pref stuff so it works and doesn't crash

35454
cf2a24d01503 Remove @file from .c files
Ankit Vani <a@nevitus.org>
parents: 35060
diff changeset
1 /* pidgin
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
2 *
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
5 * source distribution.
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 *
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * (at your option) any later version.
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 *
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * GNU General Public License for more details.
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 *
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
28321
c8d617c408ab Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents: 28278
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 */
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
21
28981
4e3922ab4844 Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <darkrain42@pidgin.im>
parents: 28709
diff changeset
22 #include "internal.h"
23728
77a48a216424 Listen to the media pipeline and display errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 23724
diff changeset
23 #include "debug.h"
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 #include "connection.h"
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
25 #include "media.h"
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
26 #include "mediamanager.h"
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
27 #include "pidgin.h"
26273
34eb5919488a Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26272
diff changeset
28 #include "request.h"
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
30 #include "gtkmedia.h"
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
31 #include "gtkutils.h"
28398
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
32 #include "pidginstock.h"
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
33
23704
9b88c9b23aed Use USE_VV instead of USE_FARSIGHT.
Michael Ruprecht <maiku@pidgin.im>
parents: 23701
diff changeset
34 #ifdef USE_VV
26639
a56751b4291d Gstreamer shouldn't be a requirement if USE_VV isn't defined.
Daniel Atallah <datallah@pidgin.im>
parents: 26629
diff changeset
35 #include "media-gst.h"
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
36
33520
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
37 #ifdef GDK_WINDOWING_WIN32
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
38 #include <gdk/gdkwin32.h>
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
39 #endif
33520
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
40 #ifdef GDK_WINDOWING_X11
33478
e6e3ac31f0b4 Move gdkx.h include to the file that really needs it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33277
diff changeset
41 #include <gdk/gdkx.h>
33520
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
42 #endif
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
43 #ifdef GDK_WINDOWING_QUARTZ
32752
8163ce6c42a6 Allow compile of V/V on OSX without X11. Patch by Eion Robb.
Eion Robb <eion@robbmob.com>
parents: 32751
diff changeset
44 #include <gdk/gdkquartz.h>
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
45 #endif
36312
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
46 #include <gdk/gdkkeysyms.h>
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
47
33170
ce4447562d64 Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33120
diff changeset
48 #include "gtk3compat.h"
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
49
26503
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
50 #define PIDGIN_TYPE_MEDIA (pidgin_media_get_type())
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
51 #define PIDGIN_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PIDGIN_TYPE_MEDIA, PidginMedia))
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
52 #define PIDGIN_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PIDGIN_TYPE_MEDIA, PidginMediaClass))
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
53 #define PIDGIN_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PIDGIN_TYPE_MEDIA))
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
54 #define PIDGIN_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PIDGIN_TYPE_MEDIA))
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
55 #define PIDGIN_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PIDGIN_TYPE_MEDIA, PidginMediaClass))
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
56
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
57 typedef struct _PidginMedia PidginMedia;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
58 typedef struct _PidginMediaClass PidginMediaClass;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
59 typedef struct _PidginMediaPrivate PidginMediaPrivate;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
60
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
61 typedef enum
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
62 {
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
63 /* Waiting for response */
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
64 PIDGIN_MEDIA_WAITING = 1,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
65 /* Got request */
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
66 PIDGIN_MEDIA_REQUESTED,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
67 /* Accepted call */
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
68 PIDGIN_MEDIA_ACCEPTED,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
69 /* Rejected call */
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
70 PIDGIN_MEDIA_REJECTED,
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
71 } PidginMediaState;
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
72
26503
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
73 struct _PidginMediaClass
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
74 {
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
75 GtkWindowClass parent_class;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
76 };
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
77
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
78 struct _PidginMedia
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
79 {
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
80 GtkWindow parent;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
81 PidginMediaPrivate *priv;
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
82 };
8f0ab2bd6cf3 Hide PidginMedia and related structs.
Michael Ruprecht <maiku@pidgin.im>
parents: 26502
diff changeset
83
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84 struct _PidginMediaPrivate
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85 {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
86 PurpleMedia *media;
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
87 gchar *screenname;
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
88 gulong level_handler_id;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
89
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
90 GtkUIManager *ui;
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
91 GtkWidget *menubar;
26285
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
92 GtkWidget *statusbar;
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
93
28709
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
94 GtkWidget *hold;
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
95 GtkWidget *mute;
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
96 GtkWidget *pause;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
97
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
98 GtkWidget *send_progress;
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
99 GHashTable *recv_progressbars;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
100
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
101 PidginMediaState state;
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
102
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
103 GtkWidget *display;
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
104 GtkWidget *send_widget;
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
105 GtkWidget *recv_widget;
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
106 GtkWidget *button_widget;
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
107 GtkWidget *local_video;
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
108 GHashTable *remote_videos;
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
109
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
110 guint timeout_id;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
111 PurpleMediaSessionType request_type;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112 };
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
114 #define PIDGIN_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PIDGIN_TYPE_MEDIA, PidginMediaPrivate))
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
116 static void pidgin_media_class_init (PidginMediaClass *klass);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117 static void pidgin_media_init (PidginMedia *media);
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
118 static void pidgin_media_dispose (GObject *object);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
119 static void pidgin_media_finalize (GObject *object);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
120 static void pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
121 static void pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
122 static void pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
123
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
124 static GtkWindowClass *parent_class = NULL;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
125
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
126
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
127 #if 0
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
128 enum {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
129 LAST_SIGNAL
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
130 };
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
131 static guint pidgin_media_signals[LAST_SIGNAL] = {0};
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
132 #endif
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
133
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
134 enum {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
135 PROP_0,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
136 PROP_MEDIA,
28126
6b4a7ccec66f Remove send_level and recv_level from PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 28125
diff changeset
137 PROP_SCREENNAME
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
138 };
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
139
26509
49519c0b7050 Silence warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 26503
diff changeset
140 static GType
22400
3762d64b1f58 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22072
diff changeset
141 pidgin_media_get_type(void)
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
142 {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
143 static GType type = 0;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
145 if (type == 0) {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146 static const GTypeInfo info = {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
147 sizeof(PidginMediaClass),
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148 NULL,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
149 NULL,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 (GClassInitFunc) pidgin_media_class_init,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
151 NULL,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
152 NULL,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
153 sizeof(PidginMedia),
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
154 0,
22072
4ad1e1e6d94e Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19886
diff changeset
155 (GInstanceInitFunc) pidgin_media_init,
4ad1e1e6d94e Remove a compile error, and a few warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 19886
diff changeset
156 NULL
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
157 };
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
158 type = g_type_register_static(GTK_TYPE_WINDOW, "PidginMedia", &info, 0);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
159 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
160 return type;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
161 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
162
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
163
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
164 static void
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
165 pidgin_media_class_init (PidginMediaClass *klass)
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
166 {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
167 GObjectClass *gobject_class = (GObjectClass*)klass;
23729
f6e9367a9d50 Silence warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 23728
diff changeset
168 /* GtkContainerClass *container_class = (GtkContainerClass*)klass; */
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
169 parent_class = g_type_class_peek_parent(klass);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
170
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
171 gobject_class->dispose = pidgin_media_dispose;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
172 gobject_class->finalize = pidgin_media_finalize;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
173 gobject_class->set_property = pidgin_media_set_property;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
174 gobject_class->get_property = pidgin_media_get_property;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
175
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176 g_object_class_install_property(gobject_class, PROP_MEDIA,
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 g_param_spec_object("media",
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178 "PurpleMedia",
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179 "The PurpleMedia associated with this media.",
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
180 PURPLE_TYPE_MEDIA,
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
181 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
182 g_object_class_install_property(gobject_class, PROP_SCREENNAME,
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
183 g_param_spec_string("screenname",
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
184 "Screenname",
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
185 "The screenname of the user this session is with.",
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
186 NULL,
35060
195dbb3b6432 pidgin: Use G_PARAM_STATIC_STRINGS and ensure g_object_notify is always called
Ankit Vani <a@nevitus.org>
parents: 34955
diff changeset
187 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
188
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
189 g_type_class_add_private(klass, sizeof(PidginMediaPrivate));
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
190 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
191
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
192 static void
28709
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
193 pidgin_media_hold_toggled(GtkToggleButton *toggle, PidginMedia *media)
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
194 {
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
195 purple_media_stream_info(media->priv->media,
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
196 gtk_toggle_button_get_active(toggle) ?
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
197 PURPLE_MEDIA_INFO_HOLD : PURPLE_MEDIA_INFO_UNHOLD,
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
198 NULL, NULL, TRUE);
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
199 }
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
200
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
201 static void
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
202 pidgin_media_mute_toggled(GtkToggleButton *toggle, PidginMedia *media)
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
203 {
26502
f0c8338ca7da Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
204 purple_media_stream_info(media->priv->media,
f0c8338ca7da Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
205 gtk_toggle_button_get_active(toggle) ?
f0c8338ca7da Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
206 PURPLE_MEDIA_INFO_MUTE : PURPLE_MEDIA_INFO_UNMUTE,
f0c8338ca7da Remove purple_media_mute.
Michael Ruprecht <maiku@pidgin.im>
parents: 26501
diff changeset
207 NULL, NULL, TRUE);
26103
1cdefa229226 Added a mute button for the local microphone.
Michael Ruprecht <maiku@pidgin.im>
parents: 26096
diff changeset
208 }
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
209
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
210 static void
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
211 pidgin_media_pause_toggled(GtkToggleButton *toggle, PidginMedia *media)
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
212 {
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
213 purple_media_stream_info(media->priv->media,
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
214 gtk_toggle_button_get_active(toggle) ?
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
215 PURPLE_MEDIA_INFO_PAUSE : PURPLE_MEDIA_INFO_UNPAUSE,
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
216 NULL, NULL, TRUE);
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
217 }
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
218
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
219 static gboolean
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
220 pidgin_media_delete_event_cb(GtkWidget *widget,
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
221 GdkEvent *event, PidginMedia *media)
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
222 {
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
223 if (media->priv->media)
26499
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
224 purple_media_stream_info(media->priv->media,
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
225 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
226 return FALSE;
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
227 }
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
228
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
229 #ifdef HAVE_X11
26283
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
230 static int
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
231 pidgin_x_error_handler(Display *display, XErrorEvent *event)
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
232 {
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
233 const gchar *error_type;
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
234 switch (event->error_code) {
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
235 #define XERRORCASE(type) case type: error_type = #type; break
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
236 XERRORCASE(BadAccess);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
237 XERRORCASE(BadAlloc);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
238 XERRORCASE(BadAtom);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
239 XERRORCASE(BadColor);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
240 XERRORCASE(BadCursor);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
241 XERRORCASE(BadDrawable);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
242 XERRORCASE(BadFont);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
243 XERRORCASE(BadGC);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
244 XERRORCASE(BadIDChoice);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
245 XERRORCASE(BadImplementation);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
246 XERRORCASE(BadLength);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
247 XERRORCASE(BadMatch);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
248 XERRORCASE(BadName);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
249 XERRORCASE(BadPixmap);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
250 XERRORCASE(BadRequest);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
251 XERRORCASE(BadValue);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
252 XERRORCASE(BadWindow);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
253 #undef XERRORCASE
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
254 default:
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
255 error_type = "unknown";
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
256 break;
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
257 }
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
258 purple_debug_error("media", "A %s Xlib error has occurred. "
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
259 "The program would normally crash now.\n",
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
260 error_type);
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
261 return 0;
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
262 }
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
263 #endif
26283
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
264
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
265 static void
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
266 menu_hangup(GtkAction *action, gpointer data)
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
267 {
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
268 PidginMedia *gtkmedia = PIDGIN_MEDIA(data);
26499
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
269 purple_media_stream_info(gtkmedia->priv->media,
759bf410db86 Remove purple_media_hangup.
Michael Ruprecht <maiku@pidgin.im>
parents: 26496
diff changeset
270 PURPLE_MEDIA_INFO_HANGUP, NULL, NULL, TRUE);
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
271 }
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
272
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
273 static const GtkActionEntry menu_entries[] = {
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
274 { "MediaMenu", NULL, N_("_Media"), NULL, NULL, NULL },
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
275 { "Hangup", NULL, N_("_Hangup"), NULL, NULL, G_CALLBACK(menu_hangup) },
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
276 };
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
277
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
278 static const char *media_menu =
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
279 "<ui>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
280 "<menubar name='Media'>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
281 "<menu action='MediaMenu'>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
282 "<menuitem action='Hangup'/>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
283 "</menu>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
284 "</menubar>"
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
285 "</ui>";
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
286
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
287 static GtkWidget *
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
288 setup_menubar(PidginMedia *window)
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
289 {
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
290 GtkActionGroup *action_group;
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
291 GError *error;
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
292 GtkAccelGroup *accel_group;
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
293 GtkWidget *menu;
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
294
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
295 action_group = gtk_action_group_new("MediaActions");
32055
b1715ca1b7d8 Fix translation of the menu items on the media window.
Mark Doliner <markdoliner@pidgin.im>
parents: 31966
diff changeset
296 #ifdef ENABLE_NLS
b1715ca1b7d8 Fix translation of the menu items on the media window.
Mark Doliner <markdoliner@pidgin.im>
parents: 31966
diff changeset
297 gtk_action_group_set_translation_domain(action_group,
b1715ca1b7d8 Fix translation of the menu items on the media window.
Mark Doliner <markdoliner@pidgin.im>
parents: 31966
diff changeset
298 PACKAGE);
b1715ca1b7d8 Fix translation of the menu items on the media window.
Mark Doliner <markdoliner@pidgin.im>
parents: 31966
diff changeset
299 #endif
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
300 gtk_action_group_add_actions(action_group,
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
301 menu_entries,
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
302 G_N_ELEMENTS(menu_entries),
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
303 GTK_WINDOW(window));
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
304
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
305 window->priv->ui = gtk_ui_manager_new();
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
306 gtk_ui_manager_insert_action_group(window->priv->ui, action_group, 0);
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
307
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
308 accel_group = gtk_ui_manager_get_accel_group(window->priv->ui);
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
309 gtk_window_add_accel_group(GTK_WINDOW(window), accel_group);
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
310
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
311 error = NULL;
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
312 if (!gtk_ui_manager_add_ui_from_string(window->priv->ui, media_menu, -1, &error))
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
313 {
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
314 g_message("building menus failed: %s", error->message);
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
315 g_error_free(error);
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
316 exit(EXIT_FAILURE);
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
317 }
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
318
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
319 menu = gtk_ui_manager_get_widget(window->priv->ui, "/Media");
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
320
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
321 gtk_widget_show(menu);
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
322 return menu;
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
323 }
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
324
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
325 static void
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
326 pidgin_media_init (PidginMedia *media)
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
327 {
26624
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
328 GtkWidget *vbox;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
329 media->priv = PIDGIN_MEDIA_GET_PRIVATE(media);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
330
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
331 #ifdef HAVE_X11
26283
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
332 XSetErrorHandler(pidgin_x_error_handler);
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
333 #endif
26283
196caad2294d Implement an X error handler to prevent Pidgin from crashing on
Michael Ruprecht <maiku@pidgin.im>
parents: 26282
diff changeset
334
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
335 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
336 gtk_container_add(GTK_CONTAINER(media), vbox);
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
337
26285
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
338 media->priv->statusbar = gtk_statusbar_new();
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
339 gtk_box_pack_end(GTK_BOX(vbox), media->priv->statusbar,
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
340 FALSE, FALSE, 0);
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
341 gtk_statusbar_push(GTK_STATUSBAR(media->priv->statusbar),
26299
e7a85461e2a7 Remove unnecessary buttons and change statusbar to say "Calling..."
Michael Ruprecht <maiku@pidgin.im>
parents: 26298
diff changeset
342 0, _("Calling..."));
26285
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
343 gtk_widget_show(media->priv->statusbar);
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
344
26298
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
345 media->priv->menubar = setup_menubar(media);
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
346 gtk_box_pack_start(GTK_BOX(vbox), media->priv->menubar,
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
347 FALSE, TRUE, 0);
ca30f1c77069 Add a basic menu to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26289
diff changeset
348
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
349 media->priv->display = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE);
26481
c5813c3ae985 Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26479
diff changeset
350 gtk_container_set_border_width(GTK_CONTAINER(media->priv->display),
c5813c3ae985 Improve padding in media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26479
diff changeset
351 PIDGIN_HIG_BOX_SPACE);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
352 gtk_box_pack_start(GTK_BOX(vbox), media->priv->display,
26255
3b0da2f49570 Remove unneeded pidgin_media_get_display_widget function.
Michael Ruprecht <maiku@pidgin.im>
parents: 26254
diff changeset
353 TRUE, TRUE, PIDGIN_HIG_BOX_SPACE);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
354 gtk_widget_show(vbox);
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
355
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
356 g_signal_connect(G_OBJECT(media), "delete-event",
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
357 G_CALLBACK(pidgin_media_delete_event_cb), media);
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
358
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
359 media->priv->recv_progressbars =
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
360 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
361 media->priv->remote_videos =
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
362 g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
363 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
364
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
365 static gchar *
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
366 create_key(const gchar *session_id, const gchar *participant)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
367 {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
368 return g_strdup_printf("%s_%s", session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
369 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
370
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
371 static void
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
372 pidgin_media_insert_widget(PidginMedia *gtkmedia, GtkWidget *widget,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
373 const gchar *session_id, const gchar *participant)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
374 {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
375 gchar *key = create_key(session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
376 PurpleMediaSessionType type =
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
377 purple_media_get_session_type(gtkmedia->priv->media, session_id);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
378
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
379 if (type & PURPLE_MEDIA_AUDIO)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
380 g_hash_table_insert(gtkmedia->priv->recv_progressbars, key, widget);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
381 else if (type & PURPLE_MEDIA_VIDEO)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
382 g_hash_table_insert(gtkmedia->priv->remote_videos, key, widget);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
383 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
384
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
385 static GtkWidget *
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
386 pidgin_media_get_widget(PidginMedia *gtkmedia,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
387 const gchar *session_id, const gchar *participant)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
388 {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
389 GtkWidget *widget = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
390 gchar *key = create_key(session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
391 PurpleMediaSessionType type =
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
392 purple_media_get_session_type(gtkmedia->priv->media, session_id);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
393
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
394 if (type & PURPLE_MEDIA_AUDIO)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
395 widget = g_hash_table_lookup(gtkmedia->priv->recv_progressbars, key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
396 else if (type & PURPLE_MEDIA_VIDEO)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
397 widget = g_hash_table_lookup(gtkmedia->priv->remote_videos, key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
398
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
399 g_free(key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
400 return widget;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
401 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
402
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
403 static void
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
404 pidgin_media_remove_widget(PidginMedia *gtkmedia,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
405 const gchar *session_id, const gchar *participant)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
406 {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
407 GtkWidget *widget = pidgin_media_get_widget(gtkmedia, session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
408
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
409 if (widget) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
410 PurpleMediaSessionType type =
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
411 purple_media_get_session_type(gtkmedia->priv->media, session_id);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
412 gchar *key = create_key(session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
413 GtkRequisition req;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
414
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
415 if (type & PURPLE_MEDIA_AUDIO) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
416 g_hash_table_remove(gtkmedia->priv->recv_progressbars, key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
417
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
418 if (g_hash_table_size(gtkmedia->priv->recv_progressbars) == 0 &&
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
419 gtkmedia->priv->send_progress) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
420
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
421 gtk_widget_destroy(gtkmedia->priv->send_progress);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
422 gtkmedia->priv->send_progress = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
423
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
424 gtk_widget_destroy(gtkmedia->priv->mute);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
425 gtkmedia->priv->mute = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
426 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
427 } else if (type & PURPLE_MEDIA_VIDEO) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
428 g_hash_table_remove(gtkmedia->priv->remote_videos, key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
429
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
430 if (g_hash_table_size(gtkmedia->priv->remote_videos) == 0 &&
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
431 gtkmedia->priv->local_video) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
432
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
433 gtk_widget_destroy(gtkmedia->priv->local_video);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
434 gtkmedia->priv->local_video = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
435
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
436 gtk_widget_destroy(gtkmedia->priv->pause);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
437 gtkmedia->priv->pause = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
438 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
439 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
440
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
441 g_free(key);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
442
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
443 gtk_widget_destroy(widget);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
444
33277
d6229108ce71 Remove deprecated gtk_widget_size_request calls.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33170
diff changeset
445 gtk_widget_get_preferred_size(GTK_WIDGET(gtkmedia), NULL, &req);
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
446 gtk_window_resize(GTK_WINDOW(gtkmedia), req.width, req.height);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
447 }
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
448 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
449
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
450 static void
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
451 level_message_cb(PurpleMedia *media, gchar *session_id, gchar *participant,
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
452 double level, PidginMedia *gtkmedia)
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
453 {
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
454 GtkWidget *progress = NULL;
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
455 if (participant == NULL)
26276
b9d3887b8318 Have all media sessions use a single pipeline.
Michael Ruprecht <maiku@pidgin.im>
parents: 26275
diff changeset
456 progress = gtkmedia->priv->send_progress;
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
457 else
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
458 progress = pidgin_media_get_widget(gtkmedia, session_id, participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
459
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
460 if (progress)
32751
24798e6f3c3a The function gst_msg_db_to_percent already retyrns a number between
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32711
diff changeset
461 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), level);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
462 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
463
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
464
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
465 static void
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
466 pidgin_media_disconnect_levels(PurpleMedia *media, PidginMedia *gtkmedia)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
467 {
26523
4544b079e3dd Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents: 26522
diff changeset
468 PurpleMediaManager *manager = purple_media_get_manager(media);
4544b079e3dd Use purple_media_manager_get_pipeline instead.
Michael Ruprecht <maiku@pidgin.im>
parents: 26522
diff changeset
469 GstElement *element = purple_media_manager_get_pipeline(manager);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
470 gulong handler_id = g_signal_handler_find(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31151
diff changeset
471 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0,
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
472 NULL, G_CALLBACK(level_message_cb), gtkmedia);
23701
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
473 if (handler_id)
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
474 g_signal_handler_disconnect(G_OBJECT(gst_pipeline_get_bus(GST_PIPELINE(element))),
ecbd92b724df Added better Farsight error handling. Fixes several crash bugs related
Michael Ruprecht <maiku@pidgin.im>
parents: 23697
diff changeset
475 handler_id);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
476 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
477
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
478 static void
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
479 pidgin_media_dispose(GObject *media)
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
480 {
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
481 PidginMedia *gtkmedia = PIDGIN_MEDIA(media);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
482 purple_debug_info("gtkmedia", "pidgin_media_dispose\n");
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
483
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
484 if (gtkmedia->priv->media) {
26300
02de47d1a94c Close the request dialog if the remote user hung up.
Michael Ruprecht <maiku@pidgin.im>
parents: 26299
diff changeset
485 purple_request_close_with_handle(gtkmedia);
26281
111754ffd39b Implement *_remove_output_window and *_remove_output_windows.
Michael Ruprecht <maiku@pidgin.im>
parents: 26276
diff changeset
486 purple_media_remove_output_windows(gtkmedia->priv->media);
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
487 pidgin_media_disconnect_levels(gtkmedia->priv->media, gtkmedia);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
488 g_object_unref(gtkmedia->priv->media);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
489 gtkmedia->priv->media = NULL;
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
490 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
491
30554
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
492 if (gtkmedia->priv->ui) {
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
493 g_object_unref(gtkmedia->priv->ui);
c429e21a08b9 Use GtkUIManager for gtk media stuff, since it's internal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30481
diff changeset
494 gtkmedia->priv->ui = NULL;
26305
04b0dd0fd8cb Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents: 26298
diff changeset
495 }
04b0dd0fd8cb Properly free item factory. Should fix a crash on close.
Michael Ruprecht <maiku@pidgin.im>
parents: 26298
diff changeset
496
31151
f352f10d5755 pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30554
diff changeset
497 if (gtkmedia->priv->timeout_id != 0)
f352f10d5755 pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30554
diff changeset
498 g_source_remove(gtkmedia->priv->timeout_id);
f352f10d5755 pidgin: Remove a timeout when destroying this object to avoid a use-after-free
Jakub Adam <jakub.adam@ktknet.cz>
parents: 30554
diff changeset
499
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
500 if (gtkmedia->priv->recv_progressbars) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
501 g_hash_table_destroy(gtkmedia->priv->recv_progressbars);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
502 g_hash_table_destroy(gtkmedia->priv->remote_videos);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
503 gtkmedia->priv->recv_progressbars = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
504 gtkmedia->priv->remote_videos = NULL;
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
505 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
506
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
507 G_OBJECT_CLASS(parent_class)->dispose(media);
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
508 }
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
509
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
510 static void
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
511 pidgin_media_finalize(GObject *media)
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
512 {
26255
3b0da2f49570 Remove unneeded pidgin_media_get_display_widget function.
Michael Ruprecht <maiku@pidgin.im>
parents: 26254
diff changeset
513 /* PidginMedia *gtkmedia = PIDGIN_MEDIA(media); */
26143
673b6665624d Restructure Jingle code to more easily support multiple application types.
Michael Ruprecht <maiku@pidgin.im>
parents: 26137
diff changeset
514 purple_debug_info("gtkmedia", "pidgin_media_finalize\n");
26210
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
515
dffd522ea21e Use the dispose method too.
Michael Ruprecht <maiku@pidgin.im>
parents: 26184
diff changeset
516 G_OBJECT_CLASS(parent_class)->finalize(media);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
517 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
518
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
519 static void
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
520 pidgin_media_emit_message(PidginMedia *gtkmedia, const char *msg)
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
521 {
34622
753f46dd000f Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents: 33958
diff changeset
522 PurpleConversation *conv = purple_conversations_find_with_account(
34662
f14347f38e3b Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
523 gtkmedia->priv->screenname,
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26728
diff changeset
524 purple_media_get_account(gtkmedia->priv->media));
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
525 if (conv != NULL)
36089
c035b9a63457 Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
526 purple_conversation_write_system_message(conv, msg, 0);
23697
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
527 }
299bafcd8eb8 Updates voice and video to use Farsight 2, gets XMPP voice conferences
Michael Ruprecht <maiku@pidgin.im>
parents: 22682
diff changeset
528
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
529 typedef struct
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
530 {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
531 PidginMedia *gtkmedia;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
532 gchar *session_id;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
533 gchar *participant;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
534 } PidginMediaRealizeData;
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
535
26233
236de657aae4 Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 26212
diff changeset
536 static gboolean
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
537 realize_cb_cb(PidginMediaRealizeData *data)
26233
236de657aae4 Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 26212
diff changeset
538 {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
539 PidginMediaPrivate *priv = data->gtkmedia->priv;
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
540 GdkWindow *window = NULL;
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
541
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
542 if (data->participant == NULL)
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
543 window = gtk_widget_get_window(priv->local_video);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
544 else {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
545 GtkWidget *widget = pidgin_media_get_widget(data->gtkmedia,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
546 data->session_id, data->participant);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
547 if (widget)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
548 window = gtk_widget_get_window(widget);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
549 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
550
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
551 if (window) {
33520
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
552 gulong window_id = 0;
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
553 #ifdef GDK_WINDOWING_WIN32
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
554 if (GDK_IS_WIN32_WINDOW(window))
33948
b6c9e5dd95d1 VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33947
diff changeset
555 window_id = GPOINTER_TO_UINT(GDK_WINDOW_HWND(window));
33520
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
556 else
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
557 #endif
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
558 #ifdef GDK_WINDOWING_X11
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
559 if (GDK_IS_X11_WINDOW(window))
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
560 window_id = gdk_x11_window_get_xid(window);
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
561 else
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
562 #endif
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
563 #ifdef GDK_WINDOWING_QUARTZ
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
564 if (GDK_IS_QUARTZ_WINDOW(window))
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
565 window_id = (gulong)gdk_quartz_window_get_nsview(window);
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
566 else
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
567 #endif
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
568 g_warning("Unsupported GDK backend");
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
569 #if !(defined(GDK_WINDOWING_WIN32) \
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
570 || defined(GDK_WINDOWING_X11) \
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
571 || defined(GDK_WINDOWING_QUARTZ))
e7741c77c5b2 Add support for multiple GDK backends.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 33510
diff changeset
572 # error "Unsupported GDK windowing system"
27972
54d25d73c6c8 Make gtkmedia.c compilable on systems without X11 (as long as they're Win32)
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 26746
diff changeset
573 #endif
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
574
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
575 purple_media_set_output_window(priv->media, data->session_id,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
576 data->participant, window_id);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
577 }
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
578
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
579 g_free(data->session_id);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
580 g_free(data->participant);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
581 g_free(data);
26233
236de657aae4 Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 26212
diff changeset
582 return FALSE;
236de657aae4 Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 26212
diff changeset
583 }
236de657aae4 Hopefully stop the last of the BadWindow errors.
Michael Ruprecht <maiku@pidgin.im>
parents: 26212
diff changeset
584
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
585 static void
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
586 realize_cb(GtkWidget *widget, PidginMediaRealizeData *data)
26177
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
587 {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
588 g_timeout_add(0, (GSourceFunc)realize_cb_cb, data);
26177
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
589 }
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
590
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
591 static void
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
592 pidgin_media_error_cb(PidginMedia *media, const char *error, PidginMedia *gtkmedia)
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
593 {
34622
753f46dd000f Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents: 33958
diff changeset
594 PurpleConversation *conv = purple_conversations_find_with_account(
34662
f14347f38e3b Refactor the remaining pidgin to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents: 34622
diff changeset
595 gtkmedia->priv->screenname,
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26728
diff changeset
596 purple_media_get_account(gtkmedia->priv->media));
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
597 if (conv != NULL) {
36089
c035b9a63457 Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
598 purple_conversation_write_system_message(
c035b9a63457 Use purple_conversation_write_system_message where appropriate
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35527
diff changeset
599 conv, error, PURPLE_MESSAGE_ERROR);
34449
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
600 } else {
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
601 purple_notify_error(NULL, NULL, _("Media error"), error,
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
602 purple_request_cpar_from_conversation(conv));
bbcb198650b7 Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34331
diff changeset
603 }
36316
2415067473ba Support GStreamer 1.x and resync with trunk
David Woodhouse <David.Woodhouse@intel.com>
parents: 36312
diff changeset
604
26285
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
605 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar),
da0d636d494a Add statusbar to eventually replace the label.
Michael Ruprecht <maiku@pidgin.im>
parents: 26284
diff changeset
606 0, error);
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
607 }
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
608
26267
3bd0240f0632 Add the accepted signal and make the accept button go away immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26259
diff changeset
609 static void
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
610 pidgin_media_accept_cb(PurpleMedia *media, int index)
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
611 {
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
612 purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT,
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
613 NULL, NULL, TRUE);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
614 }
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
615
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
616 static void
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
617 pidgin_media_reject_cb(PurpleMedia *media, int index)
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
618 {
31620
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
619 GList *iter = purple_media_get_session_ids(media);
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
620 for (; iter; iter = g_list_delete_link(iter, iter)) {
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
621 const gchar *sessionid = iter->data;
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
622 if (!purple_media_accepted(media, sessionid, NULL))
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
623 purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT,
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
624 sessionid, NULL, TRUE);
6058b133ecfd Adapt Pidgin's incoming call dialog behavior so that rejecting the addition of a
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31619
diff changeset
625 }
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
626 }
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
627
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
628 static gboolean
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
629 pidgin_request_timeout_cb(PidginMedia *gtkmedia)
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
630 {
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26728
diff changeset
631 PurpleAccount *account;
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
632 PurpleBuddy *buddy;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
633 const gchar *alias;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
634 PurpleMediaSessionType type;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
635 gchar *message = NULL;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
636
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26728
diff changeset
637 account = purple_media_get_account(gtkmedia->priv->media);
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34662
diff changeset
638 buddy = purple_blist_find_buddy(account, gtkmedia->priv->screenname);
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
639 alias = buddy ? purple_buddy_get_contact_alias(buddy) :
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
640 gtkmedia->priv->screenname;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
641 type = gtkmedia->priv->request_type;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
642 gtkmedia->priv->timeout_id = 0;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
643
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
644 if (type & PURPLE_MEDIA_AUDIO && type & PURPLE_MEDIA_VIDEO) {
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
645 message = g_strdup_printf(_("%s wishes to start an audio/video session with you."),
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
646 alias);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
647 } else if (type & PURPLE_MEDIA_AUDIO) {
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
648 message = g_strdup_printf(_("%s wishes to start an audio session with you."),
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
649 alias);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
650 } else if (type & PURPLE_MEDIA_VIDEO) {
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
651 message = g_strdup_printf(_("%s wishes to start a video session with you."),
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
652 alias);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
653 }
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
654
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
655 gtkmedia->priv->request_type = PURPLE_MEDIA_NONE;
28385
871a31df2174 There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents: 28321
diff changeset
656 if (!purple_media_accepted(gtkmedia->priv->media, NULL, NULL)) {
871a31df2174 There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents: 28321
diff changeset
657 purple_request_accept_cancel(gtkmedia, _("Incoming Call"),
34331
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33958
diff changeset
658 message, NULL, PURPLE_DEFAULT_ACTION_NONE,
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33958
diff changeset
659 purple_request_cpar_from_account(account),
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33958
diff changeset
660 gtkmedia->priv->media, pidgin_media_accept_cb,
c8486462bb63 Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33958
diff changeset
661 pidgin_media_reject_cb);
28385
871a31df2174 There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents: 28321
diff changeset
662 }
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
663 pidgin_media_emit_message(gtkmedia, message);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
664 g_free(message);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
665 return FALSE;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
666 }
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
667
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
668 static void
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
669 pidgin_media_input_volume_changed(GtkScaleButton *range, double value,
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
670 PurpleMedia *media)
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
671 {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
672 double val = (double)value * 100.0;
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
673 purple_media_set_input_volume(media, NULL, val);
26622
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
674 }
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
675
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
676 static void
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
677 pidgin_media_output_volume_changed(GtkScaleButton *range, double value,
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
678 PurpleMedia *media)
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
679 {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
680 double val = (double)value * 100.0;
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
681 purple_media_set_output_volume(media, NULL, NULL, val);
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
682 }
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
683
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
684 static void
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
685 destroy_parent_widget_cb(GtkWidget *widget, GtkWidget *parent)
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
686 {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
687 g_return_if_fail(GTK_IS_WIDGET(parent));
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
688
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
689 gtk_widget_destroy(parent);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
690 }
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
691
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
692 static GtkWidget *
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
693 pidgin_media_add_audio_widget(PidginMedia *gtkmedia,
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
694 PurpleMediaSessionType type, const gchar *sid)
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
695 {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
696 GtkWidget *volume_widget, *progress_parent, *volume, *progress;
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
697 double value;
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
698
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
699 if (type & PURPLE_MEDIA_SEND_AUDIO) {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
700 value = purple_prefs_get_int(
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
701 "/purple/media/audio/volume/input");
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
702 } else if (type & PURPLE_MEDIA_RECV_AUDIO) {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
703 value = purple_prefs_get_int(
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
704 "/purple/media/audio/volume/output");
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
705 } else
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
706 g_return_val_if_reached(NULL);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
707
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
708 /* Setup widget structure */
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
709 volume_widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE);
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
710 progress_parent = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
711 gtk_box_pack_start(GTK_BOX(volume_widget),
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
712 progress_parent, TRUE, TRUE, 0);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
713
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
714 /* Volume button */
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
715 volume = gtk_volume_button_new();
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
716 gtk_scale_button_set_value(GTK_SCALE_BUTTON(volume), value/100.0);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
717 gtk_box_pack_end(GTK_BOX(volume_widget),
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
718 volume, FALSE, FALSE, 0);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
719
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
720 /* Volume level indicator */
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
721 progress = gtk_progress_bar_new();
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
722 gtk_widget_set_size_request(progress, 250, 10);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
723 gtk_box_pack_end(GTK_BOX(progress_parent), progress, TRUE, FALSE, 0);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
724
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
725 if (type & PURPLE_MEDIA_SEND_AUDIO) {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
726 g_signal_connect (G_OBJECT(volume), "value-changed",
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
727 G_CALLBACK(pidgin_media_input_volume_changed),
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
728 gtkmedia->priv->media);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
729 gtkmedia->priv->send_progress = progress;
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
730 } else if (type & PURPLE_MEDIA_RECV_AUDIO) {
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
731 g_signal_connect (G_OBJECT(volume), "value-changed",
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
732 G_CALLBACK(pidgin_media_output_volume_changed),
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
733 gtkmedia->priv->media);
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
734
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
735 pidgin_media_insert_widget(gtkmedia, progress, sid, gtkmedia->priv->screenname);
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
736 }
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
737
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
738 g_signal_connect(G_OBJECT(progress), "destroy",
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
739 G_CALLBACK(destroy_parent_widget_cb),
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
740 volume_widget);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
741
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
742 gtk_widget_show_all(volume_widget);
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
743
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
744 return volume_widget;
26622
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
745 }
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
746
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
747 static void
36312
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
748 phone_dtmf_pressed_cb(GtkButton *button, gpointer user_data)
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
749 {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
750 PidginMedia *gtkmedia = user_data;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
751 gint num;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
752 gchar *sid;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
753
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
754 num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "dtmf-digit"));
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
755 sid = g_object_get_data(G_OBJECT(button), "session-id");
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
756
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
757 purple_media_send_dtmf(gtkmedia->priv->media, sid, num, 25, 50);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
758 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
759
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
760 static inline GtkWidget *
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
761 phone_create_button(const gchar *text_hi, const gchar *text_lo)
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
762 {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
763 GtkWidget *button;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
764 GtkWidget *label_hi;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
765 GtkWidget *label_lo;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
766 GtkWidget *grid;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
767 const gchar *text_hi_local;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
768
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
769 if (text_hi)
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
770 text_hi_local = _(text_hi);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
771 else
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
772 text_hi_local = "";
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
773
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
774 grid = gtk_vbox_new(TRUE, 0);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
775
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
776 button = gtk_button_new();
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
777 label_hi = gtk_label_new(text_hi_local);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
778 gtk_misc_set_alignment(GTK_MISC(label_hi), 0.5, 0.5);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
779 gtk_box_pack_end(GTK_BOX(grid), label_hi, FALSE, TRUE, 0);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
780 label_lo = gtk_label_new(text_lo);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
781 gtk_misc_set_alignment(GTK_MISC(label_lo), 0.5, 0.5);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
782 gtk_label_set_use_markup(GTK_LABEL(label_lo), TRUE);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
783 gtk_box_pack_end(GTK_BOX(grid), label_lo, FALSE, TRUE, 0);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
784 gtk_container_add(GTK_CONTAINER(button), grid);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
785
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
786 return button;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
787 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
788
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
789 static struct phone_label {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
790 gchar *subtext;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
791 gchar *text;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
792 gchar chr;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
793 } phone_labels[] = {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
794 {"<b>1</b>", NULL, '1'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
795 /* Translators note: These are the letters on the keys of a numeric
36339
69efd0ff9b9a Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents: 36316
diff changeset
796 keypad; translate according to the tables in §7 of ETSI ES 202 130:
69efd0ff9b9a Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents: 36316
diff changeset
797 http://webapp.etsi.org/WorkProgram/Report_WorkItem.asp?WKI_ID=11730
69efd0ff9b9a Update the link for ETSI ES 202 130
Richard Laager <rlaager@pidgin.im>
parents: 36316
diff changeset
798 */
36312
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
799 /* Letters on the '2' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
800 {"<b>2</b>", N_("ABC"), '2'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
801 /* Letters on the '3' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
802 {"<b>3</b>", N_("DEF"), '3'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
803 /* Letters on the '4' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
804 {"<b>4</b>", N_("GHI"), '4'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
805 /* Letters on the '5' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
806 {"<b>5</b>", N_("JKL"), '5'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
807 /* Letters on the '6' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
808 {"<b>6</b>", N_("MNO"), '6'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
809 /* Letters on the '7' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
810 {"<b>7</b>", N_("PQRS"), '7'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
811 /* Letters on the '8' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
812 {"<b>8</b>", N_("TUV"), '8'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
813 /* Letters on the '9' key of a numeric keypad */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
814 {"<b>9</b>", N_("WXYZ"), '9'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
815 {"<b>*</b>", NULL, '*'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
816 {"<b>0</b>", NULL, '0'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
817 {"<b>#</b>", NULL, '#'},
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
818 {NULL, NULL, 0}
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
819 };
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
820
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
821 static gboolean
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
822 pidgin_media_dtmf_key_press_event_cb(GtkWidget *widget,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
823 GdkEvent *event, gpointer user_data)
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
824 {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
825 PidginMedia *gtkmedia = user_data;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
826 GdkEventKey *key = (GdkEventKey *) event;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
827
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
828 if (event->type != GDK_KEY_PRESS) {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
829 return FALSE;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
830 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
831
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
832 if ((key->keyval >= GDK_KEY_0 && key->keyval <= GDK_KEY_9) ||
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
833 key->keyval == GDK_KEY_asterisk ||
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
834 key->keyval == GDK_KEY_numbersign) {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
835 gchar *sid = g_object_get_data(G_OBJECT(widget), "session-id");
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
836
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
837 purple_media_send_dtmf(gtkmedia->priv->media, sid, key->keyval, 25, 50);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
838 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
839
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
840 return FALSE;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
841 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
842
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
843 static GtkWidget *
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
844 pidgin_media_add_dtmf_widget(PidginMedia *gtkmedia,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
845 PurpleMediaSessionType type, const gchar *_sid)
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
846 {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
847 GtkWidget *grid = gtk_table_new(4, 3, TRUE);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
848 GtkWidget *button;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
849 gint index = 0;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
850 GtkWindow *win = &gtkmedia->parent;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
851
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
852 /* Add buttons */
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
853 for (index = 0; phone_labels[index].subtext != NULL; index++) {
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
854 button = phone_create_button(phone_labels[index].text,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
855 phone_labels[index].subtext);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
856 g_signal_connect(button, "pressed",
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
857 G_CALLBACK(phone_dtmf_pressed_cb), gtkmedia);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
858 g_object_set_data(G_OBJECT(button), "dtmf-digit",
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
859 GINT_TO_POINTER(phone_labels[index].chr));
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
860 g_object_set_data_full(G_OBJECT(button), "session-id",
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
861 g_strdup(_sid), g_free);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
862 gtk_table_attach(GTK_TABLE(grid), button, index % 3,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
863 index % 3 + 1, index / 3, index / 3 + 1,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
864 GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
865 2, 2);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
866 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
867
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
868 g_signal_connect(G_OBJECT(win), "key-press-event",
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
869 G_CALLBACK(pidgin_media_dtmf_key_press_event_cb), gtkmedia);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
870 g_object_set_data_full(G_OBJECT(win), "session-id",
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
871 g_strdup(_sid), g_free);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
872
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
873 gtk_widget_show_all(grid);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
874
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
875 return grid;
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
876 }
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
877
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
878 static void
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
879 pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia, const gchar *sid)
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
880 {
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
881 GtkWidget *send_widget = NULL, *recv_widget = NULL, *button_widget = NULL;
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
882 PurpleMediaSessionType type =
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
883 purple_media_get_session_type(media, sid);
28398
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
884 GdkPixbuf *icon = NULL;
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
885
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
886 if (gtkmedia->priv->recv_widget == NULL
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
887 && type & (PURPLE_MEDIA_RECV_VIDEO |
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
888 PURPLE_MEDIA_RECV_AUDIO)) {
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
889 recv_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BOX_SPACE);
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
890 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display),
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
891 recv_widget, TRUE, TRUE, 0);
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
892 gtk_widget_show(recv_widget);
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
893 } else {
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
894 recv_widget = gtkmedia->priv->recv_widget;
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
895 }
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
896 if (gtkmedia->priv->send_widget == NULL
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
897 && type & (PURPLE_MEDIA_SEND_VIDEO |
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
898 PURPLE_MEDIA_SEND_AUDIO)) {
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
899 send_widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, PIDGIN_HIG_BOX_SPACE);
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
900 gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display),
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
901 send_widget, FALSE, TRUE, 0);
35527
707c3c2b2c8a Fix more gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35510
diff changeset
902 button_widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, PIDGIN_HIG_BOX_SPACE);
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
903 gtk_box_pack_end(GTK_BOX(recv_widget), button_widget,
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
904 FALSE, TRUE, 0);
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
905 gtk_widget_show(send_widget);
28709
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
906
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
907 /* Hold button */
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
908 gtkmedia->priv->hold =
32056
5ecbc7cf4ee1 Mark the "hold" and "mute" menu items for translation in the media dialog.
Mark Doliner <markdoliner@pidgin.im>
parents: 32055
diff changeset
909 gtk_toggle_button_new_with_mnemonic(_("_Hold"));
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
910 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->hold,
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
911 FALSE, FALSE, 0);
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
912 gtk_widget_show(gtkmedia->priv->hold);
28709
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
913 g_signal_connect(gtkmedia->priv->hold, "toggled",
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
914 G_CALLBACK(pidgin_media_hold_toggled),
47bd5eac3afd Add a hold button to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 28421
diff changeset
915 gtkmedia);
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
916 } else {
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
917 send_widget = gtkmedia->priv->send_widget;
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
918 button_widget = gtkmedia->priv->button_widget;
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
919 }
23738
2188a1d89a3a Move the audio progress bar widgets to be beside the video displays.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
920
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
921 if (type & PURPLE_MEDIA_RECV_VIDEO) {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
922 PidginMediaRealizeData *data;
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
923 GtkWidget *aspect;
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
924 GtkWidget *remote_video;
35510
0e6c78789caa Fix some GtkStyle deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35454
diff changeset
925 GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
926
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
927 aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, FALSE);
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
928 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
23743
bc49c5e2ab2b Fix the order of the send/recv audio/video display widgets.
Michael Ruprecht <maiku@pidgin.im>
parents: 23742
diff changeset
929 gtk_box_pack_start(GTK_BOX(recv_widget), aspect, TRUE, TRUE, 0);
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
930
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
931 data = g_new0(PidginMediaRealizeData, 1);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
932 data->gtkmedia = gtkmedia;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
933 data->session_id = g_strdup(sid);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
934 data->participant = g_strdup(gtkmedia->priv->screenname);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
935
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
936 remote_video = gtk_drawing_area_new();
35510
0e6c78789caa Fix some GtkStyle deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35454
diff changeset
937 gtk_widget_override_background_color(remote_video, GTK_STATE_FLAG_NORMAL, &color);
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
938 g_signal_connect(G_OBJECT(remote_video), "realize",
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
939 G_CALLBACK(realize_cb), data);
26676
8cd0a1fc0f14 Remove old GtkPlug and GtkSocket code.
Michael Ruprecht <maiku@pidgin.im>
parents: 26639
diff changeset
940 gtk_container_add(GTK_CONTAINER(aspect), remote_video);
26284
5d36c99b8f2d Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26283
diff changeset
941 gtk_widget_set_size_request (GTK_WIDGET(remote_video), 320, 240);
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
942 g_signal_connect(G_OBJECT(remote_video), "destroy",
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
943 G_CALLBACK(destroy_parent_widget_cb), aspect);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
944
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
945 gtk_widget_show(remote_video);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
946 gtk_widget_show(aspect);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
947
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
948 pidgin_media_insert_widget(gtkmedia, remote_video,
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
949 data->session_id, data->participant);
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
950 }
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
951
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
952 if (type & PURPLE_MEDIA_SEND_VIDEO && !gtkmedia->priv->local_video) {
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
953 PidginMediaRealizeData *data;
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
954 GtkWidget *aspect;
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
955 GtkWidget *local_video;
35510
0e6c78789caa Fix some GtkStyle deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35454
diff changeset
956 GdkRGBA color = {0.0, 0.0, 0.0, 1.0};
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
957
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
958 aspect = gtk_aspect_frame_new(NULL, 0, 0, 4.0/3.0, TRUE);
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
959 gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
960 gtk_box_pack_start(GTK_BOX(send_widget), aspect, FALSE, TRUE, 0);
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
961
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
962 data = g_new0(PidginMediaRealizeData, 1);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
963 data->gtkmedia = gtkmedia;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
964 data->session_id = g_strdup(sid);
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
965 data->participant = NULL;
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
966
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
967 local_video = gtk_drawing_area_new();
35510
0e6c78789caa Fix some GtkStyle deprecations.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 35454
diff changeset
968 gtk_widget_override_background_color(local_video, GTK_STATE_FLAG_NORMAL, &color);
26177
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
969 g_signal_connect(G_OBJECT(local_video), "realize",
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
970 G_CALLBACK(realize_cb), data);
26676
8cd0a1fc0f14 Remove old GtkPlug and GtkSocket code.
Michael Ruprecht <maiku@pidgin.im>
parents: 26639
diff changeset
971 gtk_container_add(GTK_CONTAINER(aspect), local_video);
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
972 gtk_widget_set_size_request (GTK_WIDGET(local_video), 80, 60);
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
973 g_signal_connect(G_OBJECT(local_video), "destroy",
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
974 G_CALLBACK(destroy_parent_widget_cb), aspect);
26177
35f25555116f Wait for local video frame to be realized before starting local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 26158
diff changeset
975
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
976 gtk_widget_show(local_video);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
977 gtk_widget_show(aspect);
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
978
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
979 gtkmedia->priv->pause =
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
980 gtk_toggle_button_new_with_mnemonic(_("_Pause"));
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
981 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->pause,
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
982 FALSE, FALSE, 0);
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
983 gtk_widget_show(gtkmedia->priv->pause);
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
984 g_signal_connect(gtkmedia->priv->pause, "toggled",
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
985 G_CALLBACK(pidgin_media_pause_toggled),
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
986 gtkmedia);
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
987
23736
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
988 gtkmedia->priv->local_video = local_video;
e77595cce169 Preliminary video embedded in the conversation window. It's still kind of buggy.
Michael Ruprecht <maiku@pidgin.im>
parents: 23729
diff changeset
989 }
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
990 if (type & PURPLE_MEDIA_RECV_AUDIO) {
26622
b3cd53038449 Move volume levels for media to the media window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26619
diff changeset
991 gtk_box_pack_end(GTK_BOX(recv_widget),
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
992 pidgin_media_add_audio_widget(gtkmedia,
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
993 PURPLE_MEDIA_RECV_AUDIO, sid), FALSE, FALSE, 0);
23738
2188a1d89a3a Move the audio progress bar widgets to be beside the video displays.
Michael Ruprecht <maiku@pidgin.im>
parents: 23737
diff changeset
994 }
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
995
26270
c92c7e4eb004 Create the media srcs inside PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26269
diff changeset
996 if (type & PURPLE_MEDIA_SEND_AUDIO) {
26624
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
997 gtkmedia->priv->mute =
32056
5ecbc7cf4ee1 Mark the "hold" and "mute" menu items for translation in the media dialog.
Mark Doliner <markdoliner@pidgin.im>
parents: 32055
diff changeset
998 gtk_toggle_button_new_with_mnemonic(_("_Mute"));
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
999 gtk_box_pack_end(GTK_BOX(button_widget), gtkmedia->priv->mute,
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1000 FALSE, FALSE, 0);
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1001 gtk_widget_show(gtkmedia->priv->mute);
26624
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
1002 g_signal_connect(gtkmedia->priv->mute, "toggled",
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
1003 G_CALLBACK(pidgin_media_mute_toggled),
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
1004 gtkmedia);
d8be4ebac4f0 Improve the padding around the mute button.
Michael Ruprecht <maiku@pidgin.im>
parents: 26623
diff changeset
1005
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1006 gtk_box_pack_end(GTK_BOX(recv_widget),
26728
e6d5b2333b1d Use GtkVolumeButtons for audio if it's available.
Michael Ruprecht <maiku@pidgin.im>
parents: 26676
diff changeset
1007 pidgin_media_add_audio_widget(gtkmedia,
36312
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
1008 PURPLE_MEDIA_SEND_AUDIO, sid), FALSE, FALSE, 0);
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
1009
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
1010 gtk_box_pack_end(GTK_BOX(recv_widget),
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
1011 pidgin_media_add_dtmf_widget(gtkmedia,
6b4576edf2a6 Add out-of-band DTMF support and dialpad to use it
David Woodhouse <David.Woodhouse@intel.com>
parents: 32056
diff changeset
1012 PURPLE_MEDIA_SEND_AUDIO, sid), FALSE, FALSE, 0);
26113
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
1013 }
ad871f934f18 Decouple stream direction. Allows send only or recv only streams.
Michael Ruprecht <maiku@pidgin.im>
parents: 26108
diff changeset
1014
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1015 if (type & PURPLE_MEDIA_AUDIO &&
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1016 gtkmedia->priv->level_handler_id == 0) {
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1017 gtkmedia->priv->level_handler_id = g_signal_connect(
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1018 media, "level", G_CALLBACK(level_message_cb),
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1019 gtkmedia);
26259
0983517fc75f Wait to create the sinks until the frames are ready.
Michael Ruprecht <maiku@pidgin.im>
parents: 26255
diff changeset
1020 }
26151
218a4f61cf0d Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1021
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1022 if (send_widget != NULL)
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1023 gtkmedia->priv->send_widget = send_widget;
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1024 if (recv_widget != NULL)
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1025 gtkmedia->priv->recv_widget = recv_widget;
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1026 if (button_widget != NULL) {
28133
4b84b16a01af Add pause capability for local video.
Michael Ruprecht <maiku@pidgin.im>
parents: 28126
diff changeset
1027 gtkmedia->priv->button_widget = button_widget;
30481
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1028 gtk_widget_show(GTK_WIDGET(button_widget));
97ccb2147ce3 pidgin: Re-arrange media window. Layout remote and local video side-by-side.
Marcus Lundblad <malu@pidgin.im>
parents: 28981
diff changeset
1029 }
26151
218a4f61cf0d Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
Michael Ruprecht <maiku@pidgin.im>
parents: 26143
diff changeset
1030
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26512
diff changeset
1031 if (purple_media_is_initiator(media, sid, NULL) == FALSE) {
26512
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1032 if (gtkmedia->priv->timeout_id != 0)
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1033 g_source_remove(gtkmedia->priv->timeout_id);
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1034 gtkmedia->priv->request_type |= type;
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1035 gtkmedia->priv->timeout_id = g_timeout_add(500,
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1036 (GSourceFunc)pidgin_request_timeout_cb,
0a10f7f30fd6 Display which type of media session is being requested.
Michael Ruprecht <maiku@pidgin.im>
parents: 26510
diff changeset
1037 gtkmedia);
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
1038 }
26284
5d36c99b8f2d Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26283
diff changeset
1039
28398
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1040 /* set the window icon according to the type */
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1041 if (type & PURPLE_MEDIA_VIDEO) {
28421
0fa0e4979c49 Fix another warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 28398
diff changeset
1042 icon = gtk_widget_render_icon(GTK_WIDGET(gtkmedia),
0fa0e4979c49 Fix another warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 28398
diff changeset
1043 PIDGIN_STOCK_TOOLBAR_VIDEO_CALL,
28398
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1044 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), NULL);
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1045 } else if (type & PURPLE_MEDIA_AUDIO) {
28421
0fa0e4979c49 Fix another warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 28398
diff changeset
1046 icon = gtk_widget_render_icon(GTK_WIDGET(gtkmedia),
0fa0e4979c49 Fix another warning.
Michael Ruprecht <maiku@pidgin.im>
parents: 28398
diff changeset
1047 PIDGIN_STOCK_TOOLBAR_AUDIO_CALL,
28398
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1048 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_LARGE), NULL);
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1049 }
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1050
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1051 if (icon) {
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1052 gtk_window_set_icon(GTK_WINDOW(gtkmedia), icon);
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1053 g_object_unref(icon);
acc1ddff586b Set the icon of media corresponding to the media type
Marcus Lundblad <malu@pidgin.im>
parents: 28385
diff changeset
1054 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31151
diff changeset
1055
26284
5d36c99b8f2d Make the sinks better default sizes and display them immediately.
Michael Ruprecht <maiku@pidgin.im>
parents: 26283
diff changeset
1056 gtk_widget_show(gtkmedia->priv->display);
23737
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
1057 }
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
1058
91165a8fcbd9 Notify the user which type of media session the remote user wants to initiate.
Michael Ruprecht <maiku@pidgin.im>
parents: 23736
diff changeset
1059 static void
26449
9e381dc6ed24 Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents: 26444
diff changeset
1060 pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
26240
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1061 gchar *sid, gchar *name, PidginMedia *gtkmedia)
22400
3762d64b1f58 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22072
diff changeset
1062 {
26449
9e381dc6ed24 Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents: 26444
diff changeset
1063 purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n",
27974
2021706e911d Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 27972
diff changeset
1064 state, sid ? sid : "(null)", name ? name : "(null)");
31619
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
1065 if (state == PURPLE_MEDIA_STATE_END) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
1066 if (sid != NULL && name != NULL) {
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
1067 pidgin_media_remove_widget(gtkmedia, sid, name);
8eeb5fc86dcf Adapt the Pidgin UI to correctly handle dynamic addition and removal of streams
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31557
diff changeset
1068 } else if (sid == NULL && name == NULL) {
26240
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1069 pidgin_media_emit_message(gtkmedia,
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1070 _("The call has been terminated."));
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1071 gtk_widget_destroy(GTK_WIDGET(gtkmedia));
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1072 }
26449
9e381dc6ed24 Rename state-changed enum and values.
Michael Ruprecht <maiku@pidgin.im>
parents: 26444
diff changeset
1073 } else if (state == PURPLE_MEDIA_STATE_NEW &&
26242
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1074 sid != NULL && name != NULL) {
4e3c5480ef0f Replace the ready signal in PidginMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26241
diff changeset
1075 pidgin_media_ready_cb(media, gtkmedia, sid);
26240
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1076 }
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1077 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1078
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1079 static void
26444
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1080 pidgin_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
26496
11e1e5221460 Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26494
diff changeset
1081 gchar *sid, gchar *name, gboolean local,
11e1e5221460 Create purple_media_stream_info. Add local parameter to stream-info signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26494
diff changeset
1082 PidginMedia *gtkmedia)
26444
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1083 {
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1084 if (type == PURPLE_MEDIA_INFO_REJECT) {
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1085 pidgin_media_emit_message(gtkmedia,
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1086 _("You have rejected the call."));
28111
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
1087 } else if (type == PURPLE_MEDIA_INFO_ACCEPT) {
28385
871a31df2174 There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents: 28321
diff changeset
1088 if (local == TRUE)
871a31df2174 There's no reason to ask for acceptance if the stream has been accepted. Also,
Michael Ruprecht <maiku@pidgin.im>
parents: 28321
diff changeset
1089 purple_request_close_with_handle(gtkmedia);
28111
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
1090 pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
1091 pidgin_media_emit_message(gtkmedia, _("Call in progress."));
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
1092 gtk_statusbar_push(GTK_STATUSBAR(gtkmedia->priv->statusbar),
32695
f86582a6bc5b Remove a period from a phrase that appears in the status bar of active calls
Mark Doliner <markdoliner@pidgin.im>
parents: 31966
diff changeset
1093 0, _("Call in progress"));
28111
61de2e173be9 Remove the "accepted" signal from PurpleMedia as it was redundant.
Michael Ruprecht <maiku@pidgin.im>
parents: 27974
diff changeset
1094 gtk_widget_show(GTK_WIDGET(gtkmedia));
26444
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1095 }
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1096 }
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1097
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1098 static void
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1099 pidgin_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1100 {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1101 PidginMedia *media;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1102 g_return_if_fail(PIDGIN_IS_MEDIA(object));
22400
3762d64b1f58 Show a message when the remote end terminates a session.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22072
diff changeset
1103
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1104 media = PIDGIN_MEDIA(object);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1105 switch (prop_id) {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1106 case PROP_MEDIA:
26241
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1107 {
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1108 if (media->priv->media)
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1109 g_object_unref(media->priv->media);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1110 media->priv->media = g_value_get_object(value);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1111 g_object_ref(media->priv->media);
26241
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1112
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26512
diff changeset
1113 if (purple_media_is_initiator(media->priv->media,
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26512
diff changeset
1114 NULL, NULL) == TRUE)
26241
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1115 pidgin_media_set_state(media, PIDGIN_MEDIA_WAITING);
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1116 else
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1117 pidgin_media_set_state(media, PIDGIN_MEDIA_REQUESTED);
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1118
26182
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
1119 g_signal_connect(G_OBJECT(media->priv->media), "error",
728ad1da9cbc Add purple_media_error.
Michael Ruprecht <maiku@pidgin.im>
parents: 26177
diff changeset
1120 G_CALLBACK(pidgin_media_error_cb), media);
26240
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1121 g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
3bc5338843aa Convert PidginMedia to use the state-changed signal.
Michael Ruprecht <maiku@pidgin.im>
parents: 26234
diff changeset
1122 G_CALLBACK(pidgin_media_state_changed_cb), media);
26444
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1123 g_signal_connect(G_OBJECT(media->priv->media), "stream-info",
55d385e7faad Use stream-info for reject instead of state-changed.
Michael Ruprecht <maiku@pidgin.im>
parents: 26439
diff changeset
1124 G_CALLBACK(pidgin_media_stream_info_cb), media);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1125 break;
26241
d4be7f79d6bc Convert more PidginMedia signals to the newer API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26240
diff changeset
1126 }
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1127 case PROP_SCREENNAME:
37424
04cf8cbe44d8 Remove more NULL-checks before free().
Michael McConville <mmcco@mykolab.com>
parents: 37422
diff changeset
1128 g_free(media->priv->screenname);
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1129 media->priv->screenname = g_value_dup_string(value);
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1130 break;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1131 default:
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1132 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1133 break;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1134 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1135 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1136
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1137 static void
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1138 pidgin_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1139 {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1140 PidginMedia *media;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1141 g_return_if_fail(PIDGIN_IS_MEDIA(object));
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1142
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1143 media = PIDGIN_MEDIA(object);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1144
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1145 switch (prop_id) {
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1146 case PROP_MEDIA:
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1147 g_value_set_object(value, media->priv->media);
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1148 break;
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1149 case PROP_SCREENNAME:
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1150 g_value_set_string(value, media->priv->screenname);
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1151 break;
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1152 default:
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1153 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1154 break;
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1155 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1156 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1157
26494
829997fe9c23 No reason for this to be public API.
Michael Ruprecht <maiku@pidgin.im>
parents: 26488
diff changeset
1158 static GtkWidget *
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1159 pidgin_media_new(PurpleMedia *media, const gchar *screenname)
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1160 {
23721
15285d082f6c Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Michael Ruprecht <maiku@pidgin.im>
parents: 23704
diff changeset
1161 PidginMedia *gtkmedia = g_object_new(pidgin_media_get_type(),
26184
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1162 "media", media,
db732f8c4d29 Remove the screenname attribute from PurpleMedia.
Michael Ruprecht <maiku@pidgin.im>
parents: 26182
diff changeset
1163 "screenname", screenname, NULL);
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1164 return GTK_WIDGET(gtkmedia);
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1165 }
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1166
22682
8df904a56d77 Change a few things:
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22648
diff changeset
1167 static void
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1168 pidgin_media_set_state(PidginMedia *gtkmedia, PidginMediaState state)
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1169 {
22648
e286d795c5f9 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 22400
diff changeset
1170 gtkmedia->priv->state = state;
19886
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1171 }
84cef48efbc5 Missing files
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1172
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1173 static gboolean
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1174 pidgin_media_new_cb(PurpleMediaManager *manager, PurpleMedia *media,
26746
2a2d45ac9774 Switch media to store accounts rather than connections.
Michael Ruprecht <maiku@pidgin.im>
parents: 26728
diff changeset
1175 PurpleAccount *account, gchar *screenname, gpointer nul)
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1176 {
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1177 PidginMedia *gtkmedia = PIDGIN_MEDIA(
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1178 pidgin_media_new(media, screenname));
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34662
diff changeset
1179 PurpleBuddy *buddy = purple_blist_find_buddy(account, screenname);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31151
diff changeset
1180 const gchar *alias = buddy ?
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31151
diff changeset
1181 purple_buddy_get_contact_alias(buddy) : screenname;
26275
69951c5ca44f Use aliases for the media window title and the request window.
Michael Ruprecht <maiku@pidgin.im>
parents: 26273
diff changeset
1182 gtk_window_set_title(GTK_WINDOW(gtkmedia), alias);
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1183
26514
058053cffc0e Add purple_media_is_initiator.
Michael Ruprecht <maiku@pidgin.im>
parents: 26512
diff changeset
1184 if (purple_media_is_initiator(media, NULL, NULL) == TRUE)
26273
34eb5919488a Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26272
diff changeset
1185 gtk_widget_show(GTK_WIDGET(gtkmedia));
34eb5919488a Use request API for a media invitation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26272
diff changeset
1186
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1187 return TRUE;
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1188 }
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1189
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1190 static GstElement *
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1191 create_vv_element(const gchar *plugin, const gchar *device)
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1192 {
33958
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1193 GstElement *element, *source;
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1194
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1195 g_return_val_if_fail(plugin != NULL, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1196 g_return_val_if_fail(plugin[0] != '\0', NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1197
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1198 if (device != NULL && device[0] == '\0')
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1199 device = NULL;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1200
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1201 if (g_strcmp0(plugin, "videodisabledsrc") == 0) {
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1202 element = gst_element_factory_make("videotestsrc", NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1203 g_object_set(G_OBJECT(element), "is-live", TRUE, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1204 if (g_strcmp0(device, "snow") == 0) {
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1205 /* GST_VIDEO_TEST_SRC_SNOW */
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1206 g_object_set(G_OBJECT(element), "pattern", 1, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1207 } else {
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1208 /* GST_VIDEO_TEST_SRC_BLACK */
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1209 g_object_set(G_OBJECT(element), "pattern", 2, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1210 }
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1211 return element;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1212 }
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1213
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1214 if (g_strcmp0(plugin, "ksvideosrc") == 0) {
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1215 GstElement *ksv_bin, *ksv_src, *ksv_filter;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1216 GstPad *ksv_pad, *ksv_ghost;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1217
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1218 ksv_bin = gst_bin_new("ksvideofilteredsrc");
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1219 ksv_src = gst_element_factory_make("ksvideosrc", NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1220 ksv_filter = gst_element_factory_make("ffmpegcolorspace", NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1221
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1222 gst_bin_add_many(GST_BIN(ksv_bin), ksv_src, ksv_filter, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1223
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1224 gst_element_link(ksv_src, ksv_filter);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1225
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1226 ksv_pad = gst_element_get_static_pad(ksv_filter, "src");
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1227 ksv_ghost = gst_ghost_pad_new("src", ksv_pad);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1228 gst_object_unref(ksv_pad);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1229 gst_element_add_pad(ksv_bin, ksv_ghost);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1230
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1231 element = ksv_bin;
33958
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1232 source = ksv_src;
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1233 }
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1234 else
33958
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1235 element = source = gst_element_factory_make(plugin, NULL);
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1236
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1237 if (element == NULL)
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1238 return NULL;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1239
33958
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1240 if (device != NULL) {
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1241 GObjectClass *klass = G_OBJECT_GET_CLASS(source);
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1242 if (g_object_class_find_property(klass, "device"))
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1243 g_object_set(G_OBJECT(source), "device", device, NULL);
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1244 else if (g_object_class_find_property(klass, "device-index"))
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1245 g_object_set(G_OBJECT(source), "device-index",
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1246 g_ascii_strtoull(device, NULL, 10), NULL);
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1247 else
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1248 purple_debug_warning("gtkmedia", "No possibility to "
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1249 "set device\n");
d76b1d242829 VV: add another method of probing devices (by device-name), fix memleak
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33957
diff changeset
1250 }
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1251
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1252 if (g_strcmp0(plugin, "videotestsrc") == 0)
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1253 g_object_set(G_OBJECT(element), "is-live", TRUE, NULL);
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1254
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1255 return element;
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1256 }
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1257
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1258 static GstElement *
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1259 create_configured_vv_element(const gchar *type, const gchar *dir)
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1260 {
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1261 gchar *tmp;
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1262 const gchar *plugin, *device;
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1263
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1264 tmp = g_strdup_printf(PIDGIN_PREFS_ROOT "/vvconfig/%s/%s/plugin",
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1265 type, dir);
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1266 plugin = purple_prefs_get_string(tmp);
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1267 g_free(tmp);
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1268
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1269 tmp = g_strdup_printf(PIDGIN_PREFS_ROOT "/vvconfig/%s/%s/device",
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1270 type, dir);
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1271 device = purple_prefs_get_string(tmp);
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1272 g_free(tmp);
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1273
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1274 if (plugin == NULL || plugin[0] == '\0')
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1275 return NULL;
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1276
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1277 return create_vv_element(plugin, device);
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1278 }
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1279
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1280 static GstElement *
26522
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1281 create_default_video_src(PurpleMedia *media,
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1282 const gchar *session_id, const gchar *participant)
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1283 {
31311
740a84050c72 Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31294
diff changeset
1284 GstElement *sendbin, *src;
26462
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1285 GstPad *pad;
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1286 GstPad *ghost;
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1287
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1288 src = create_configured_vv_element("video", "src");
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1289
28163
7e41e62cf99f Handle sources for Windows better.
Michael Ruprecht <maiku@pidgin.im>
parents: 28141
diff changeset
1290 #ifdef _WIN32
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1291 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1292 src = create_vv_element("ksvideosrc", NULL);
28163
7e41e62cf99f Handle sources for Windows better.
Michael Ruprecht <maiku@pidgin.im>
parents: 28141
diff changeset
1293 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1294 src = create_vv_element("dshowvideosrc", NULL);
28163
7e41e62cf99f Handle sources for Windows better.
Michael Ruprecht <maiku@pidgin.im>
parents: 28141
diff changeset
1295 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1296 src = create_vv_element("autovideosrc", NULL);
32752
8163ce6c42a6 Allow compile of V/V on OSX without X11. Patch by Eion Robb.
Eion Robb <eion@robbmob.com>
parents: 32751
diff changeset
1297 #elif defined(__APPLE__)
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1298 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1299 src = create_vv_element("osxvideosrc", NULL);
32752
8163ce6c42a6 Allow compile of V/V on OSX without X11. Patch by Eion Robb.
Eion Robb <eion@robbmob.com>
parents: 32751
diff changeset
1300 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1301 src = create_vv_element("autovideosrc", NULL);
28163
7e41e62cf99f Handle sources for Windows better.
Michael Ruprecht <maiku@pidgin.im>
parents: 28141
diff changeset
1302 #else
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1303 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1304 src = create_vv_element("gconfvideosrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1305 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1306 src = create_vv_element("autovideosrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1307 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1308 src = create_vv_element("v4l2src", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1309 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1310 src = create_vv_element("v4lsrc", NULL);
28163
7e41e62cf99f Handle sources for Windows better.
Michael Ruprecht <maiku@pidgin.im>
parents: 28141
diff changeset
1311 #endif
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1312 if (src == NULL)
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1313 src = create_vv_element("videotestsrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1314 if (src == NULL) {
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1315 purple_debug_error("gtkmedia", "Unable to find a suitable "
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1316 "element for the default video source.\n");
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1317 return NULL;
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1318 }
26462
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1319
26507
629bdcfe9516 Unique elements ought to be named the same as their id.
Michael Ruprecht <maiku@pidgin.im>
parents: 26504
diff changeset
1320 sendbin = gst_bin_new("pidgindefaultvideosrc");
26462
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1321
31311
740a84050c72 Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31294
diff changeset
1322 gst_bin_add(GST_BIN(sendbin), src);
26462
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1323
31311
740a84050c72 Add a GstCapsFilter between every video source and the rest of the pipeline.
Jakub Adam <jakub.adam@ktknet.cz>
parents: 31294
diff changeset
1324 pad = gst_element_get_static_pad(src, "src");
26462
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1325 ghost = gst_ghost_pad_new("ghostsrc", pad);
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1326 gst_object_unref(pad);
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1327 gst_element_add_pad(sendbin, ghost);
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1328
78777290e568 Remove purple_media_video_init_* functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26457
diff changeset
1329 return sendbin;
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1330 }
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1331
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1332 static GstElement *
26522
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1333 create_default_video_sink(PurpleMedia *media,
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1334 const gchar *session_id, const gchar *participant)
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1335 {
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1336 GstElement *sink;
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1337
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1338 sink = create_configured_vv_element("video", "sink");
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1339
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1340 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1341 sink = create_vv_element("directdrawsink", NULL);
33948
b6c9e5dd95d1 VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33947
diff changeset
1342 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1343 sink = create_vv_element("gconfvideosink", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1344 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1345 sink = create_vv_element("autovideosink", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1346 if (sink == NULL)
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1347 purple_debug_error("gtkmedia", "Unable to find a suitable "
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1348 "element for the default video sink.\n");
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1349 return sink;
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1350 }
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1351
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1352 static GstElement *
26522
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1353 create_default_audio_src(PurpleMedia *media,
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1354 const gchar *session_id, const gchar *participant)
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1355 {
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1356 GstElement *src;
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1357
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1358 src = create_configured_vv_element("audio", "src");
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1359
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1360 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1361 src = create_vv_element("directsoundsrc", NULL);
33948
b6c9e5dd95d1 VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33947
diff changeset
1362 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1363 src = create_vv_element("gconfaudiosrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1364 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1365 src = create_vv_element("autoaudiosrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1366 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1367 src = create_vv_element("alsasrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1368 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1369 src = create_vv_element("osssrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1370 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1371 src = create_vv_element("dshowaudiosrc", NULL);
32752
8163ce6c42a6 Allow compile of V/V on OSX without X11. Patch by Eion Robb.
Eion Robb <eion@robbmob.com>
parents: 32751
diff changeset
1372 if (src == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1373 src = create_vv_element("osxaudiosrc", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1374 if (src == NULL) {
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1375 purple_debug_error("gtkmedia", "Unable to find a suitable "
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1376 "element for the default audio source.\n");
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1377 return NULL;
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1378 }
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1379 gst_element_set_name(src, "pidgindefaultaudiosrc");
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1380 return src;
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1381 }
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1382
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1383 static GstElement *
26522
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1384 create_default_audio_sink(PurpleMedia *media,
44401eba59a5 Give more information to element creation functions.
Michael Ruprecht <maiku@pidgin.im>
parents: 26521
diff changeset
1385 const gchar *session_id, const gchar *participant)
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1386 {
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1387 GstElement *sink;
33947
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1388
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1389 sink = create_configured_vv_element("audio", "sink");
7c0420c7ac81 VV: make prefs actually working; add <Disabled> video source
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33946
diff changeset
1390
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1391 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1392 sink = create_vv_element("directsoundsink", NULL);
33948
b6c9e5dd95d1 VV: win32 support. No runtimes dependencies in dep-bundle yet. Refs #11075
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33947
diff changeset
1393 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1394 sink = create_vv_element("gconfaudiosink", NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1395 if (sink == NULL)
33957
0a4c13fa94ba VV: some cleanup, add ffmpeg filter to ksvideosrc
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33948
diff changeset
1396 sink = create_vv_element("autoaudiosink",NULL);
26627
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1397 if (sink == NULL) {
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1398 purple_debug_error("gtkmedia", "Unable to find a suitable "
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1399 "element for the default audio sink.\n");
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1400 return NULL;
7c86ad54e2cf Use better choices for default elements and have fallbacks.
Michael Ruprecht <maiku@pidgin.im>
parents: 26624
diff changeset
1401 }
28125
2e47531fc140 Unlink the local audio volume and mute between sessions.
Michael Ruprecht <maiku@pidgin.im>
parents: 28111
diff changeset
1402 return sink;
26289
1d832b48fa58 Add active elements to PurpleMediaManager. These are the elements that
Michael Ruprecht <maiku@pidgin.im>
parents: 26288
diff changeset
1403 }
26504
55082249a5f9 Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26503
diff changeset
1404 #endif /* USE_VV */
26287
c0cdd840a828 Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents: 26285
diff changeset
1405
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1406 void
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1407 pidgin_medias_init(void)
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1408 {
26504
55082249a5f9 Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26503
diff changeset
1409 #ifdef USE_VV
26287
c0cdd840a828 Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents: 26285
diff changeset
1410 PurpleMediaManager *manager = purple_media_manager_get();
26616
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1411 PurpleMediaElementInfo *default_video_src =
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1412 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1413 "id", "pidgindefaultvideosrc",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1414 "name", "Pidgin Default Video Source",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1415 "type", PURPLE_MEDIA_ELEMENT_VIDEO
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1416 | PURPLE_MEDIA_ELEMENT_SRC
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1417 | PURPLE_MEDIA_ELEMENT_ONE_SRC
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1418 | PURPLE_MEDIA_ELEMENT_UNIQUE,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1419 "create-cb", create_default_video_src, NULL);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1420 PurpleMediaElementInfo *default_video_sink =
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1421 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1422 "id", "pidgindefaultvideosink",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1423 "name", "Pidgin Default Video Sink",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1424 "type", PURPLE_MEDIA_ELEMENT_VIDEO
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1425 | PURPLE_MEDIA_ELEMENT_SINK
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1426 | PURPLE_MEDIA_ELEMENT_ONE_SINK,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1427 "create-cb", create_default_video_sink, NULL);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1428 PurpleMediaElementInfo *default_audio_src =
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1429 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1430 "id", "pidgindefaultaudiosrc",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1431 "name", "Pidgin Default Audio Source",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1432 "type", PURPLE_MEDIA_ELEMENT_AUDIO
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1433 | PURPLE_MEDIA_ELEMENT_SRC
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1434 | PURPLE_MEDIA_ELEMENT_ONE_SRC
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1435 | PURPLE_MEDIA_ELEMENT_UNIQUE,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1436 "create-cb", create_default_audio_src, NULL);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1437 PurpleMediaElementInfo *default_audio_sink =
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1438 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1439 "id", "pidgindefaultaudiosink",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1440 "name", "Pidgin Default Audio Sink",
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1441 "type", PURPLE_MEDIA_ELEMENT_AUDIO
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1442 | PURPLE_MEDIA_ELEMENT_SINK
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1443 | PURPLE_MEDIA_ELEMENT_ONE_SINK,
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1444 "create-cb", create_default_audio_sink, NULL);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1445
26287
c0cdd840a828 Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents: 26285
diff changeset
1446 g_signal_connect(G_OBJECT(manager), "init-media",
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1447 G_CALLBACK(pidgin_media_new_cb), NULL);
26287
c0cdd840a828 Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents: 26285
diff changeset
1448
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31151
diff changeset
1449 purple_media_manager_set_ui_caps(manager,
26521
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1450 PURPLE_MEDIA_CAPS_AUDIO |
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1451 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION |
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1452 PURPLE_MEDIA_CAPS_VIDEO |
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1453 PURPLE_MEDIA_CAPS_VIDEO_SINGLE_DIRECTION |
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1454 PURPLE_MEDIA_CAPS_AUDIO_VIDEO);
f7f083e8cd31 Declare which media caps Pidgin and Finch handle.
Michael Ruprecht <maiku@pidgin.im>
parents: 26514
diff changeset
1455
26287
c0cdd840a828 Implement functions to register and unregister media elements for use in
Michael Ruprecht <maiku@pidgin.im>
parents: 26285
diff changeset
1456 purple_debug_info("gtkmedia", "Registering media element types\n");
26616
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1457 purple_media_manager_set_active_element(manager, default_video_src);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1458 purple_media_manager_set_active_element(manager, default_video_sink);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1459 purple_media_manager_set_active_element(manager, default_audio_src);
4f58db29d346 Hide and gobjectify PurpleMediaElementInfo.
Michael Ruprecht <maiku@pidgin.im>
parents: 26523
diff changeset
1460 purple_media_manager_set_active_element(manager, default_audio_sink);
26504
55082249a5f9 Fix compiling with --disable-vv.
Michael Ruprecht <maiku@pidgin.im>
parents: 26503
diff changeset
1461 #endif
26269
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1462 }
cacc598079e4 Separate PidginMedia from PidginConversation.
Michael Ruprecht <maiku@pidgin.im>
parents: 26267
diff changeset
1463

mercurial