pidgin/plugins/vvconfig.c

Sat, 22 Aug 2009 00:36:25 +0000

author
Michael Ruprecht <maiku@pidgin.im>
date
Sat, 22 Aug 2009 00:36:25 +0000
changeset 28324
f9ef953c00bf
child 30745
8346d194d563
permissions
-rw-r--r--

Add the vvconfig plugin. It allows you to choose different microphones,
webcams, and output elements from the defaults.

28324
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
1 /*
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
2 * Configures microphones and webcams for voice and video
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
3 * Copyright (C) 2009 Mike Ruprecht <cmaiku@gmail.com>
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
4 *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
6 * modify it under the terms of the GNU General Public License
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
7 * as published by the Free Software Foundation; either version 2
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
8 * of the License, or (at your option) any later version.
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
9 *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
13 * GNU General Public License for more details.
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
14 *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
18 */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
19 #include "internal.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
20
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
21 #include "debug.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
22 #include "mediamanager.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
23 #include "media-gst.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
24 #include "version.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
25 #include "gtkplugin.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
26 #include "gtkutils.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
27 #include "gtkprefs.h"
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
28
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
29 #include <gst/interfaces/propertyprobe.h>
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
30
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
31 static PurpleMediaElementInfo *old_video_src = NULL, *old_video_sink = NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
32 *old_audio_src = NULL, *old_audio_sink = NULL;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
33
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
34 static const gchar *AUDIO_SRC_PLUGINS[] = {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
35 "alsasrc", "ALSA",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
36 /* "esdmon", "ESD", ? */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
37 "osssrc", "OSS",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
38 "pulsesrc", "PulseAudio",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
39 /* "audiotestsrc wave=silence", "Silence", */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
40 "audiotestsrc", "Test Sound",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
41 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
42 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
43
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
44 static const gchar *AUDIO_SINK_PLUGINS[] = {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
45 "alsasink", "ALSA",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
46 "artsdsink", "aRts",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
47 "esdsink", "ESD",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
48 "osssink", "OSS",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
49 "pulsesink", "PulseAudio",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
50 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
51 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
52
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
53 static const gchar *VIDEO_SRC_PLUGINS[] = {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
54 "videotestsrc", "Test Input",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
55 "dshowvideosrc","DirectDraw",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
56 "ksvideosrc", "KS Video",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
57 "qcamsrc", "Quickcam",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
58 "v4lsrc", "Video4Linux",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
59 "v4l2src", "Video4Linux2",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
60 "v4lmjpegsrc", "Video4Linux MJPEG",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
61 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
62 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
63
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
64 static const gchar *VIDEO_SINK_PLUGINS[] = {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
65 /* "aasink", "AALib", Didn't work for me */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
66 "directdrawsink","DirectDraw",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
67 "glimagesink", "OpenGL",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
68 "ximagesink", "X Window System",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
69 "xvimagesink", "X Window System (Xv)",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
70 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
71 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
72
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
73 static GList *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
74 get_element_devices(const gchar *element_name)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
75 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
76 GList *ret = NULL;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
77 GstElement *element;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
78 GObjectClass *klass;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
79 GstPropertyProbe *probe;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
80 const GParamSpec *pspec;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
81
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
82 if (!strcmp(element_name, "<custom>")) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
83 ret = g_list_prepend(ret, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
84 ret = g_list_prepend(ret, (gpointer)_("Default"));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
85 ret = g_list_prepend(ret, "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
86 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
87 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
88
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
89 ret = g_list_prepend(ret, (gpointer)_("Default"));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
90 ret = g_list_prepend(ret, "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
91
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
92 if (*element_name == '\0') {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
93 ret = g_list_prepend(ret, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
94 ret = g_list_reverse(ret);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
95 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
96 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
97
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
98 element = gst_element_factory_make(element_name, "test");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
99 klass = G_OBJECT_GET_CLASS (element);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
100 if (!g_object_class_find_property(klass, "device") ||
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
101 !GST_IS_PROPERTY_PROBE(element) ||
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
102 !(probe = GST_PROPERTY_PROBE(element)) ||
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
103 !(pspec = gst_property_probe_get_property(probe, "device"))) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
104 purple_debug_info("vvconfig", "'%s' - no device\n", element_name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
105 } else {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
106 gint n;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
107 GValueArray *array;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
108
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
109 /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
110 if (g_object_class_find_property (klass, "autoprobe")) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
111 g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
112 if (g_object_class_find_property (klass, "autoprobe-fps")) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
113 g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
114 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
115 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
116
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
117 array = gst_property_probe_probe_and_get_values (probe, pspec);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
118 if (array == NULL) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
119 purple_debug_info("vvconfig", "'%s' has no devices\n", element_name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
120 ret = g_list_prepend(ret, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
121 ret = g_list_reverse(ret);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
122 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
123 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
124
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
125 for (n=0; n < array->n_values; ++n) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
126 GValue *device;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
127 const gchar *name;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
128 const gchar *device_name;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
129
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
130 device = g_value_array_get_nth(array, n);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
131 g_object_set_property(G_OBJECT(element), "device", device);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
132 if (gst_element_set_state(element, GST_STATE_READY)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
133 != GST_STATE_CHANGE_SUCCESS) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
134 purple_debug_warning("vvconfig",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
135 "Error changing state of %s\n",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
136 element_name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
137 continue;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
138 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
139
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
140 g_object_get(G_OBJECT(element), "device-name", &name, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
141 device_name = g_value_get_string(device);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
142 if (name == NULL)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
143 name = _("Unknown");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
144 purple_debug_info("vvconfig", "Found device %s : %s for %s\n",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
145 device_name, name, element_name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
146 ret = g_list_prepend(ret, (gpointer)name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
147 ret = g_list_prepend(ret, (gpointer)device_name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
148 gst_element_set_state(element, GST_STATE_NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
149 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
150 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
151 gst_object_unref(element);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
152
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
153 ret = g_list_prepend(ret, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
154 ret = g_list_reverse(ret);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
155
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
156 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
157 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
158
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
159 static GList *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
160 get_element_plugins(const gchar **plugins)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
161 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
162 GList *ret = NULL;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
163
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
164 ret = g_list_prepend(ret, "Default");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
165 ret = g_list_prepend(ret, "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
166 for (; plugins[0] && plugins[1]; plugins += 2) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
167 if (gst_default_registry_check_feature_version(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
168 plugins[0], 0, 0, 0)) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
169 ret = g_list_prepend(ret, (gpointer)plugins[1]);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
170 ret = g_list_prepend(ret, (gpointer)plugins[0]);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
171 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
172 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
173 ret = g_list_prepend(ret, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
174 ret = g_list_reverse(ret);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
175 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
176 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
177
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
178 static void
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
179 device_changed_cb(const gchar *name, PurplePrefType type,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
180 gconstpointer value, gpointer data)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
181 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
182 GtkSizeGroup *sg = data;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
183 GtkWidget *parent, *widget;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
184 GSList *widgets;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
185 GList *devices;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
186 GValue gvalue;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
187 gint position;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
188 gchar *label, *pref;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
189
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
190 widgets = gtk_size_group_get_widgets(GTK_SIZE_GROUP(sg));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
191 for (; widgets; widgets = g_slist_next(widgets)) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
192 const gchar *widget_name =
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
193 gtk_widget_get_name(GTK_WIDGET(widgets->data));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
194 if (!strcmp(widget_name, name)) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
195 gchar *temp_str;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
196 gchar delimiters[3] = {0, 0, 0};
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
197 const gchar *text;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
198 gint keyval, pos;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
199
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
200 widget = widgets->data;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
201 /* Get label with _ from the GtkLabel */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
202 text = gtk_label_get_text(GTK_LABEL(widget));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
203 keyval = gtk_label_get_mnemonic_keyval(GTK_LABEL(widget));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
204 delimiters[0] = g_ascii_tolower(keyval);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
205 delimiters[1] = g_ascii_toupper(keyval);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
206 pos = strcspn(text, delimiters);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
207 if (pos != -1) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
208 temp_str = g_strndup(text, pos);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
209 label = g_strconcat(temp_str, "_",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
210 text + pos, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
211 g_free(temp_str);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
212 } else {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
213 label = g_strdup(text);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
214 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
215 break;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
216 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
217 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
218
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
219 if (widgets == NULL)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
220 return;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
221
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
222 parent = gtk_widget_get_parent(widget);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
223 widget = parent;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
224 parent = gtk_widget_get_parent(GTK_WIDGET(widget));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
225 gvalue.g_type = 0;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
226 g_value_init(&gvalue, G_TYPE_INT);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
227 gtk_container_child_get_property(GTK_CONTAINER(parent),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
228 GTK_WIDGET(widget), "position", &gvalue);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
229 position = g_value_get_int(&gvalue);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
230 g_value_unset(&gvalue);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
231 gtk_widget_destroy(widget);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
232
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
233 pref = g_strdup(name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
234 strcpy(pref + strlen(pref) - strlen("plugin"), "device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
235 devices = get_element_devices(value);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
236 if (g_list_find(devices, purple_prefs_get_string(pref)) == NULL)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
237 purple_prefs_set_string(pref, g_list_next(devices)->data);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
238 widget = pidgin_prefs_dropdown_from_list(parent,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
239 label, PURPLE_PREF_STRING,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
240 pref, devices);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
241 g_list_free(devices);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
242 g_signal_connect_swapped(widget, "destroy",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
243 G_CALLBACK(g_free), pref);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
244 g_free(label);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
245 gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
246 gtk_widget_set_name(widget, name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
247 gtk_size_group_add_widget(sg, widget);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
248 gtk_box_reorder_child(GTK_BOX(parent),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
249 gtk_widget_get_parent(GTK_WIDGET(widget)), position);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
250 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
251
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
252 static void
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
253 get_plugin_frame(GtkWidget *parent, GtkSizeGroup *sg,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
254 const gchar *name, const gchar *plugin_label,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
255 const gchar **plugin_strs, const gchar *plugin_pref,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
256 const gchar *device_label, const gchar *device_pref)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
257 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
258 GtkWidget *vbox, *widget;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
259 GList *plugins, *devices;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
260
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
261 vbox = pidgin_make_frame(parent, name);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
262
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
263 /* Setup plugin preference */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
264 plugins = get_element_plugins(plugin_strs);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
265 widget = pidgin_prefs_dropdown_from_list(vbox, plugin_label,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
266 PURPLE_PREF_STRING, plugin_pref, plugins);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
267 g_list_free(plugins);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
268 gtk_size_group_add_widget(sg, widget);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
269 gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
270
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
271 /* Setup device preference */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
272 devices = get_element_devices(purple_prefs_get_string(plugin_pref));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
273 if (g_list_find(devices, purple_prefs_get_string(device_pref)) == NULL)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
274 purple_prefs_set_string(device_pref, g_list_next(devices)->data);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
275 widget = pidgin_prefs_dropdown_from_list(vbox, device_label,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
276 PURPLE_PREF_STRING, device_pref, devices);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
277 g_list_free(devices);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
278 gtk_widget_set_name(widget, plugin_pref);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
279 gtk_size_group_add_widget(sg, widget);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
280 gtk_misc_set_alignment(GTK_MISC(widget), 0, 0.5);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
281
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
282 purple_prefs_connect_callback(vbox, plugin_pref,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
283 device_changed_cb, sg);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
284 g_signal_connect_swapped(vbox, "destroy",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
285 G_CALLBACK(purple_prefs_disconnect_by_handle), vbox);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
286 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
287
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
288 static GtkWidget *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
289 get_plugin_config_frame(PurplePlugin *plugin) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
290 GtkWidget *notebook, *vbox_audio, *vbox_video;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
291 GtkSizeGroup *sg;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
292
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
293 notebook = gtk_notebook_new();
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
294 gtk_container_set_border_width(GTK_CONTAINER(notebook),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
295 PIDGIN_HIG_BORDER);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
296 gtk_widget_show(notebook);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
297
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
298 vbox_audio = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
299 vbox_video = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
300 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
301 vbox_audio, gtk_label_new(_("Audio")));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
302 gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
303 vbox_video, gtk_label_new(_("Video")));
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
304 gtk_container_set_border_width(GTK_CONTAINER (vbox_audio),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
305 PIDGIN_HIG_BORDER);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
306 gtk_container_set_border_width(GTK_CONTAINER (vbox_video),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
307 PIDGIN_HIG_BORDER);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
308
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
309 gtk_widget_show(vbox_audio);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
310 gtk_widget_show(vbox_video);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
311
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
312 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
313
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
314 get_plugin_frame(vbox_audio, sg, _("Output"), _("_Plugin"), AUDIO_SINK_PLUGINS,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
315 "/plugins/core/vvconfig/audio/sink/plugin", _("_Device"),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
316 "/plugins/core/vvconfig/audio/sink/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
317 get_plugin_frame(vbox_audio, sg, _("Input"), _("P_lugin"), AUDIO_SRC_PLUGINS,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
318 "/plugins/core/vvconfig/audio/src/plugin", _("D_evice"),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
319 "/plugins/core/vvconfig/audio/src/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
320
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
321 get_plugin_frame(vbox_video, sg, _("Output"), _("_Plugin"), VIDEO_SINK_PLUGINS,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
322 "/plugins/gtk/vvconfig/video/sink/plugin", _("_Device"),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
323 "/plugins/gtk/vvconfig/video/sink/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
324 get_plugin_frame(vbox_video, sg, _("Input"), _("P_lugin"), VIDEO_SRC_PLUGINS,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
325 "/plugins/core/vvconfig/video/src/plugin", _("D_evice"),
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
326 "/plugins/core/vvconfig/video/src/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
327
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
328 return notebook;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
329 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
330
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
331 static GstElement *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
332 create_video_src(PurpleMedia *media,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
333 const gchar *session_id, const gchar *participant)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
334 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
335 const gchar *plugin = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
336 "/plugins/core/vvconfig/video/src/plugin");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
337 const gchar *device = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
338 "/plugins/core/vvconfig/video/src/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
339 GstElement *ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
340
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
341 if (plugin[0] == '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
342 return purple_media_element_info_call_create(old_video_src,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
343 media, session_id, participant);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
344
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
345 ret = gst_element_factory_make(plugin, "vvconfig-videosrc");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
346 if (device[0] != '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
347 g_object_set(G_OBJECT(ret), "device", device, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
348 if (!strcmp(plugin, "videotestsrc"))
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
349 g_object_set(G_OBJECT(ret), "is-live", 1, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
350 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
351 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
352
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
353 static GstElement *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
354 create_video_sink(PurpleMedia *media,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
355 const gchar *session_id, const gchar *participant)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
356 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
357 const gchar *plugin = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
358 "/plugins/gtk/vvconfig/video/sink/plugin");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
359 const gchar *device = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
360 "/plugins/gtk/vvconfig/video/sink/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
361 GstElement *ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
362
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
363 if (plugin[0] == '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
364 return purple_media_element_info_call_create(old_video_sink,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
365 media, session_id, participant);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
366
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
367 ret = gst_element_factory_make(plugin, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
368 if (device[0] != '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
369 g_object_set(G_OBJECT(ret), "device", device, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
370 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
371 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
372
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
373 static GstElement *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
374 create_audio_src(PurpleMedia *media,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
375 const gchar *session_id, const gchar *participant)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
376 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
377 const gchar *plugin = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
378 "/plugins/core/vvconfig/audio/src/plugin");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
379 const gchar *device = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
380 "/plugins/core/vvconfig/audio/src/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
381 GstElement *ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
382
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
383 if (plugin[0] == '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
384 return purple_media_element_info_call_create(old_audio_src,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
385 media, session_id, participant);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
386
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
387 ret = gst_element_factory_make(plugin, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
388 if (device[0] != '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
389 g_object_set(G_OBJECT(ret), "device", device, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
390 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
391 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
392
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
393 static GstElement *
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
394 create_audio_sink(PurpleMedia *media,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
395 const gchar *session_id, const gchar *participant)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
396 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
397 const gchar *plugin = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
398 "/plugins/core/vvconfig/audio/sink/plugin");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
399 const gchar *device = purple_prefs_get_string(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
400 "/plugins/core/vvconfig/audio/sink/device");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
401 GstElement *ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
402
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
403 if (plugin[0] == '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
404 return purple_media_element_info_call_create(old_audio_sink,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
405 media, session_id, participant);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
406
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
407 ret = gst_element_factory_make(plugin, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
408 if (device[0] != '\0')
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
409 g_object_set(G_OBJECT(ret), "device", device, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
410 return ret;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
411 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
412
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
413 static void
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
414 set_element_info_cond(PurpleMediaElementInfo *old_info,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
415 PurpleMediaElementInfo *new_info, const gchar *id)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
416 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
417 gchar *element_id = purple_media_element_info_get_id(old_info);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
418 if (!strcmp(element_id, id))
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
419 purple_media_manager_set_active_element(
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
420 purple_media_manager_get(), new_info);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
421 g_free(element_id);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
422 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
423
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
424 static gboolean
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
425 plugin_load(PurplePlugin *plugin)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
426 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
427 PurpleMediaManager *manager;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
428 PurpleMediaElementInfo *video_src, *video_sink,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
429 *audio_src, *audio_sink;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
430
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
431 /* Disable the plugin if the UI doesn't support VV */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
432 if (purple_media_manager_get_ui_caps(purple_media_manager_get()) ==
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
433 PURPLE_MEDIA_CAPS_NONE)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
434 return FALSE;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
435
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
436 purple_prefs_add_none("/plugins/core/vvconfig");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
437 purple_prefs_add_none("/plugins/core/vvconfig/audio");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
438 purple_prefs_add_none("/plugins/core/vvconfig/audio/src");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
439 purple_prefs_add_string("/plugins/core/vvconfig/audio/src/plugin", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
440 purple_prefs_add_string("/plugins/core/vvconfig/audio/src/device", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
441 purple_prefs_add_none("/plugins/core/vvconfig/audio/sink");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
442 purple_prefs_add_string("/plugins/core/vvconfig/audio/sink/plugin", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
443 purple_prefs_add_string("/plugins/core/vvconfig/audio/sink/device", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
444 purple_prefs_add_none("/plugins/core/vvconfig/video");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
445 purple_prefs_add_none("/plugins/core/vvconfig/video/src");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
446 purple_prefs_add_string("/plugins/core/vvconfig/video/src/plugin", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
447 purple_prefs_add_string("/plugins/core/vvconfig/video/src/device", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
448 purple_prefs_add_none("/plugins/gtk/vvconfig");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
449 purple_prefs_add_none("/plugins/gtk/vvconfig/video");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
450 purple_prefs_add_none("/plugins/gtk/vvconfig/video/sink");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
451 purple_prefs_add_string("/plugins/gtk/vvconfig/video/sink/plugin", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
452 purple_prefs_add_string("/plugins/gtk/vvconfig/video/sink/device", "");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
453
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
454 video_src = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
455 "id", "vvconfig-videosrc",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
456 "name", "VV Conf Plugin Video Source",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
457 "type", PURPLE_MEDIA_ELEMENT_VIDEO
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
458 | PURPLE_MEDIA_ELEMENT_SRC
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
459 | PURPLE_MEDIA_ELEMENT_ONE_SRC
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
460 | PURPLE_MEDIA_ELEMENT_UNIQUE,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
461 "create-cb", create_video_src, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
462 video_sink = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
463 "id", "vvconfig-videosink",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
464 "name", "VV Conf Plugin Video Sink",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
465 "type", PURPLE_MEDIA_ELEMENT_VIDEO
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
466 | PURPLE_MEDIA_ELEMENT_SINK
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
467 | PURPLE_MEDIA_ELEMENT_ONE_SINK,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
468 "create-cb", create_video_sink, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
469 audio_src = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
470 "id", "vvconfig-audiosrc",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
471 "name", "VV Conf Plugin Audio Source",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
472 "type", PURPLE_MEDIA_ELEMENT_AUDIO
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
473 | PURPLE_MEDIA_ELEMENT_SRC
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
474 | PURPLE_MEDIA_ELEMENT_ONE_SRC
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
475 | PURPLE_MEDIA_ELEMENT_UNIQUE,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
476 "create-cb", create_audio_src, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
477 audio_sink = g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
478 "id", "vvconfig-audiosink",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
479 "name", "VV Conf Plugin Audio Sink",
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
480 "type", PURPLE_MEDIA_ELEMENT_AUDIO
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
481 | PURPLE_MEDIA_ELEMENT_SINK
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
482 | PURPLE_MEDIA_ELEMENT_ONE_SINK,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
483 "create-cb", create_audio_sink, NULL);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
484
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
485 purple_debug_info("gtkmedia", "Registering media element types\n");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
486 manager = purple_media_manager_get();
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
487
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
488 old_video_src = purple_media_manager_get_active_element(manager,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
489 PURPLE_MEDIA_ELEMENT_VIDEO | PURPLE_MEDIA_ELEMENT_SRC);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
490 old_video_sink = purple_media_manager_get_active_element(manager,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
491 PURPLE_MEDIA_ELEMENT_VIDEO | PURPLE_MEDIA_ELEMENT_SINK);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
492 old_audio_src = purple_media_manager_get_active_element(manager,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
493 PURPLE_MEDIA_ELEMENT_AUDIO | PURPLE_MEDIA_ELEMENT_SRC);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
494 old_audio_sink = purple_media_manager_get_active_element(manager,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
495 PURPLE_MEDIA_ELEMENT_AUDIO | PURPLE_MEDIA_ELEMENT_SINK);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
496
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
497 set_element_info_cond(old_video_src, video_src, "pidgindefaultvideosrc");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
498 set_element_info_cond(old_video_sink, video_sink, "pidgindefaultvideosink");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
499 set_element_info_cond(old_audio_src, audio_src, "pidgindefaultaudiosrc");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
500 set_element_info_cond(old_audio_sink, audio_sink, "pidgindefaultaudiosink");
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
501
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
502 return TRUE;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
503 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
504
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
505 static gboolean
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
506 plugin_unload(PurplePlugin *plugin)
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
507 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
508 PurpleMediaManager *manager = purple_media_manager_get();
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
509 purple_media_manager_set_active_element(manager, old_video_src);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
510 purple_media_manager_set_active_element(manager, old_video_sink);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
511 purple_media_manager_set_active_element(manager, old_audio_src);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
512 purple_media_manager_set_active_element(manager, old_audio_sink);
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
513 return TRUE;
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
514 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
515
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
516 static PidginPluginUiInfo ui_info = {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
517 get_plugin_config_frame,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
518 0, /* page_num (Reserved) */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
519 /* Padding */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
520 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
521 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
522 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
523 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
524 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
525
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
526 static PurplePluginInfo info =
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
527 {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
528 PURPLE_PLUGIN_MAGIC, /**< magic */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
529 PURPLE_MAJOR_VERSION, /**< major version */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
530 PURPLE_MINOR_VERSION, /**< minor version */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
531 PURPLE_PLUGIN_STANDARD, /**< type */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
532 PIDGIN_PLUGIN_TYPE, /**< ui_requirement */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
533 0, /**< flags */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
534 NULL, /**< dependencies */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
535 PURPLE_PRIORITY_DEFAULT, /**< priority */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
536
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
537 "gtk-maiku-vvconfig", /**< id */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
538 N_("Voice/Video Settings"), /**< name */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
539 DISPLAY_VERSION, /**< version */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
540 N_("Configure your microphone and webcam."), /**< summary */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
541 N_("Configure microphone and webcam "
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
542 "settings for voice/video calls."), /**< description */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
543 "Mike Ruprecht <cmaiku@gmail.com>", /**< author */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
544 PURPLE_WEBSITE, /**< homepage */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
545
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
546 plugin_load, /**< load */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
547 plugin_unload, /**< unload */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
548 NULL, /**< destroy */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
549
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
550 &ui_info, /**< ui_info */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
551 NULL, /**< extra_info */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
552 NULL, /**< prefs_info */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
553 NULL, /**< actions */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
554
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
555 /* padding */
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
556 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
557 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
558 NULL,
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
559 NULL
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
560 };
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
561
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
562 static void
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
563 init_plugin(PurplePlugin *plugin) {
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
564 }
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
565
f9ef953c00bf Add the vvconfig plugin. It allows you to choose different microphones,
Michael Ruprecht <maiku@pidgin.im>
parents:
diff changeset
566 PURPLE_INIT_PLUGIN(vvconfig, init_plugin, info)

mercurial