author | yippi |
Mon, 27 Sep 2010 21:07:51 +0000 | |
changeset 20108 | 51df67ca9307 |
parent 18220 | 14c4093b6689 |
permissions | -rw-r--r-- |
17844 | 1 |
diff --git a/configure.ac b/configure.ac |
2 |
index 5fada1a..b450ff0 100644 |
|
3 |
--- a/configure.ac |
|
4 |
+++ b/configure.ac |
|
5 |
@@ -271,6 +271,48 @@ AM_CONDITIONAL(HAVE_PULSE, test "x$have_ |
|
6 |
AC_SUBST(PULSE_CFLAGS) |
|
7 |
AC_SUBST(PULSE_LIBS) |
|
8 |
||
9 |
+dnl ============================================== |
|
10 |
+dnl GStreamer section |
|
11 |
+dnl ============================================== |
|
12 |
+GST_MAJORMINOR=auto |
|
13 |
+ |
|
14 |
+AC_ARG_ENABLE(gstreamer, |
|
15 |
+AC_HELP_STRING([--enable-gstreamer],[use gstreamer if available (and optionally specify a version)]), |
|
16 |
+[case "${enableval}" in |
|
17 |
+ yes) ENABLE_GSTREAMER=yes ;; |
|
18 |
+ 0.10) ENABLE_GSTREAMER=yes && GST_MAJORMINOR=0.10 ;; |
|
19 |
+ no) ENABLE_GSTREAMER=no ;; |
|
20 |
+ *) AC_MSG_ERROR([ |
|
21 |
+ *** Bad value ${enableval} for --enable-gstreamer |
|
22 |
+ *** Please use one of the following: |
|
23 |
+ *** --enable-gstreamer=0.10 |
|
24 |
+ ]) ;; |
|
25 |
+esac], |
|
26 |
+[ENABLE_GSTREAMER=yes]) dnl Default value |
|
27 |
+ |
|
28 |
+have_gstreamer=no |
|
29 |
+if test "x$ENABLE_GSTREAMER" = "xyes"; then |
|
30 |
+ GST_REQS=0.10.1.2 |
|
31 |
+ PKGS="gstreamer-0.10 >= $GST_REQS gstreamer-plugins-base-0.10 >= $GST_REQS" |
|
32 |
+ |
|
33 |
+ PKG_CHECK_MODULES(GST, $PKGS, have_gstreamer=yes, |
|
34 |
+ AC_MSG_RESULT([no])) |
|
35 |
+ |
|
36 |
+ if test "x$have_pulse" = "xtrue"; then |
|
37 |
+ AC_MSG_ERROR([*** GStreamer & Pulseaudio both are selected ***]) |
|
38 |
+ fi |
|
39 |
+ |
|
40 |
+ if test "x$have_gstreamer" = "xyes"; then |
|
41 |
+ GST_LIBS="$GST_LIBS -lgstinterfaces-0.10 -lgstaudio-0.10" |
|
42 |
+ AC_DEFINE(HAVE_GSTREAMER,1,[enable gstreamer]) |
|
43 |
+ fi |
|
44 |
+else |
|
45 |
+ AC_MSG_NOTICE([*** GStreamer support disabled ***]) |
|
46 |
+fi |
|
47 |
+AM_CONDITIONAL(HAVE_GSTREAMER, test "x$have_gstreamer" = "xyes") |
|
48 |
+AC_SUBST(GST_LIBS) |
|
49 |
+AC_SUBST(GST_CFLAGS) |
|
50 |
+ |
|
51 |
# --------------------------------------------------------------------------- |
|
52 |
# Enable Profiling |
|
53 |
# --------------------------------------------------------------------------- |
|
54 |
@@ -409,6 +451,7 @@ echo " |
|
55 |
dbus-1 system.d dir: ${DBUS_SYS_DIR} |
|
56 |
||
57 |
Libnotify support: ${have_libnotify} |
|
58 |
+ GStreamer support: ${have_gstreamer} |
|
59 |
PulseAudio support: ${have_pulse} |
|
60 |
Profiling support: ${enable_profiling} |
|
61 |
" |
|
62 |
diff --git a/plugins/media-keys/Makefile.am b/plugins/media-keys/Makefile.am |
|
63 |
index fae8a5e..edb215e 100644 |
|
64 |
--- a/plugins/media-keys/Makefile.am |
|
65 |
+++ b/plugins/media-keys/Makefile.am |
|
66 |
diff --git a/plugins/media-keys/cut-n-paste/Makefile.am b/plugins/media-keys/cut-n-paste/Makefile.am |
|
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
67 |
@@ -3,13 +3,8 @@ context = actions |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
68 |
|
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
69 |
NULL = |
17845 | 70 |
|
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
71 |
-SUBDIRS = |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
72 |
-plugin_LTLIBRARIES = |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
73 |
- |
17845 | 74 |
-if HAVE_PULSE |
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
75 |
-SUBDIRS += cut-n-paste |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
76 |
-plugin_LTLIBRARIES += libmedia-keys.la |
17845 | 77 |
-endif |
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
78 |
+SUBDIRS = cut-n-paste |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
79 |
+plugin_LTLIBRARIES = libmedia-keys.la |
17844 | 80 |
|
81 |
BUILT_SOURCES = \ |
|
17845 | 82 |
gsd-media-keys-manager-glue.h \ |
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
83 |
@@ -108,9 +103,7 @@ libmedia_keys_la_LIBADD = \ |
17845 | 84 |
plugin_in_files = \ |
85 |
media-keys.gnome-settings-plugin.in |
|
17844 | 86 |
|
17845 | 87 |
-if HAVE_PULSE |
17844 | 88 |
plugin_DATA = $(plugin_in_files:.gnome-settings-plugin.in=.gnome-settings-plugin) |
17845 | 89 |
-endif |
17844 | 90 |
|
91 |
noinst_PROGRAMS = \ |
|
17845 | 92 |
test-media-keys \ |
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
93 |
@@ -176,9 +169,7 @@ test_media_keys_LDADD = \ |
17845 | 94 |
$(GST_LIBS) \ |
95 |
-lm |
|
17844 | 96 |
|
17845 | 97 |
-if HAVE_PULSE |
17844 | 98 |
test_media_keys_LDADD += $(top_builddir)/plugins/media-keys/cut-n-paste/libgvc.la |
17845 | 99 |
-endif |
17844 | 100 |
|
101 |
gtkbuilderdir = $(pkgdatadir) |
|
17845 | 102 |
gtkbuilder_DATA = \ |
17844 | 103 |
index bc59a10..6486ac0 100644 |
104 |
--- a/plugins/media-keys/cut-n-paste/Makefile.am |
|
105 |
+++ b/plugins/media-keys/cut-n-paste/Makefile.am |
|
106 |
@@ -4,16 +4,24 @@ noinst_LTLIBRARIES = libgvc.la |
|
107 |
||
108 |
INCLUDES = \ |
|
109 |
$(WARN_CFLAGS) \ |
|
110 |
- $(VOLUME_CONTROL_CFLAGS) \ |
|
111 |
- $(PULSE_CFLAGS) \ |
|
112 |
$(NULL) |
|
113 |
||
114 |
libgvc_la_LIBADD = \ |
|
115 |
- $(VOLUME_CONTROL_LIBS) \ |
|
116 |
- $(PULSE_LIBS) \ |
|
117 |
$(NULL) |
|
118 |
||
119 |
libgvc_la_SOURCES = \ |
|
120 |
+ $(NULL) |
|
121 |
+ |
|
122 |
+if HAVE_PULSE |
|
123 |
+INCLUDES += \ |
|
124 |
+ $(VOLUME_CONTROL_CFLAGS) \ |
|
125 |
+ $(PULSE_CFLAGS) |
|
126 |
+ |
|
127 |
+libgvc_la_LIBADD += \ |
|
128 |
+ $(VOLUME_CONTROL_LIBS) \ |
|
129 |
+ $(PULSE_LIBS) |
|
130 |
+ |
|
131 |
+libgvc_la_SOURCES += \ |
|
132 |
gvc-mixer-stream.h \ |
|
133 |
gvc-mixer-stream.c \ |
|
134 |
gvc-channel-map.h \ |
|
135 |
@@ -31,8 +39,22 @@ libgvc_la_SOURCES = \ |
|
136 |
gvc-mixer-event-role.h \ |
|
137 |
gvc-mixer-event-role.c \ |
|
138 |
gvc-mixer-control.h \ |
|
139 |
- gvc-mixer-control.c \ |
|
140 |
- $(NULL) |
|
141 |
+ gvc-mixer-control.c |
|
142 |
+endif |
|
143 |
+ |
|
144 |
+if HAVE_GSTREAMER |
|
145 |
+INCLUDES += \ |
|
146 |
+ $(SETTINGS_PLUGIN_CFLAGS) \ |
|
147 |
+ $(AM_CFLAGS) \ |
|
148 |
+ $(GST_CFLAGS) |
|
149 |
+ |
|
150 |
+libgvc_la_LIBADD += \ |
|
151 |
+ $(GST_LIBS) |
|
152 |
+ |
|
153 |
+libgvc_la_SOURCES += \ |
|
154 |
+ gvc-gstreamer-acme-vol.c \ |
|
155 |
+ gvc-gstreamer-acme-vol.h |
|
156 |
+endif |
|
157 |
||
158 |
MAINTAINERCLEANFILES = \ |
|
159 |
*~ \ |
|
160 |
diff --git a/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c |
|
161 |
new file mode 100644 |
|
162 |
index 0000000..8948480 |
|
163 |
--- /dev/null |
|
164 |
+++ b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.c |
|
165 |
@@ -0,0 +1,472 @@ |
|
166 |
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ |
|
167 |
+ |
|
168 |
+/* acme-volume.c |
|
169 |
+ |
|
170 |
+ Copyright (C) 2002, 2003 Bastien Nocera |
|
171 |
+ Copyright (C) 2004 Novell, Inc. |
|
172 |
+ Copyright (C) 2009 PERIER Romain <[email protected]> |
|
173 |
+ |
|
174 |
+ The Gnome Library is free software; you can redistribute it and/or |
|
175 |
+ modify it under the terms of the GNU Library General Public License as |
|
176 |
+ published by the Free Software Foundation; either version 2 of the |
|
177 |
+ License, or (at your option) any later version. |
|
178 |
+ |
|
179 |
+ The Gnome Library is distributed in the hope that it will be useful, |
|
180 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
181 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
182 |
+ Library General Public License for more details. |
|
183 |
+ |
|
184 |
+ You should have received a copy of the GNU Library General Public |
|
185 |
+ License along with the Gnome Library; see the file COPYING.LIB. If not, |
|
186 |
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
187 |
+ Boston, MA 02111-1307, USA. |
|
188 |
+ |
|
189 |
+ Author: Bastien Nocera <[email protected]> |
|
190 |
+ Jon Trowbridge <[email protected]> |
|
191 |
+*/ |
|
192 |
+ |
|
193 |
+#include "config.h" |
|
194 |
+#include "gvc-gstreamer-acme-vol.h" |
|
195 |
+ |
|
196 |
+#include <glib.h> |
|
197 |
+#include <glib/gi18n.h> |
|
198 |
+ |
|
199 |
+#include <gst/gst.h> |
|
200 |
+#include <gst/audio/mixerutils.h> |
|
201 |
+#include <gst/interfaces/mixer.h> |
|
202 |
+#include <gst/interfaces/propertyprobe.h> |
|
203 |
+ |
|
204 |
+#include <gconf/gconf-client.h> |
|
205 |
+ |
|
206 |
+#include <string.h> |
|
207 |
+ |
|
208 |
+#define TIMEOUT 2 |
|
209 |
+ |
|
210 |
+#define DEFAULT_MIXER_DEVICE_KEY "/desktop/gnome/sound/default_mixer_device" |
|
211 |
+#define DEFAULT_MIXER_TRACKS_KEY "/desktop/gnome/sound/default_mixer_tracks" |
|
212 |
+#define GNOME_VOLUME_CONTROL_KEY_ACTIVE_ELEMENT "/apps/gnome-volume-control/active-element" |
|
213 |
+ |
|
214 |
+ |
|
215 |
+#define ACME_VOLUME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ACME_TYPE_VOLUME, AcmeVolumePrivate)) |
|
216 |
+ |
|
217 |
+struct AcmeVolumePrivate { |
|
218 |
+ GstMixer *mixer; |
|
219 |
+ GList *mixer_tracks; |
|
220 |
+ guint timer_id; |
|
221 |
+ gdouble volume; |
|
222 |
+ gboolean mute; |
|
223 |
+ GConfClient *gconf_client; |
|
224 |
+ gchar *gvc_mixer; |
|
225 |
+ gboolean found_mixer; |
|
226 |
+}; |
|
227 |
+ |
|
228 |
+G_DEFINE_TYPE (AcmeVolume, acme_volume, G_TYPE_OBJECT) |
|
229 |
+ |
|
230 |
+static gboolean acme_volume_open (AcmeVolume *acme); |
|
231 |
+static void acme_volume_close (AcmeVolume *acme); |
|
232 |
+static gboolean acme_volume_close_real (AcmeVolume *self); |
|
233 |
+ |
|
234 |
+static gpointer acme_volume_object = NULL; |
|
235 |
+ |
|
236 |
+static void |
|
237 |
+acme_volume_finalize (GObject *object) |
|
238 |
+{ |
|
239 |
+ AcmeVolume *self; |
|
240 |
+ |
|
241 |
+ g_return_if_fail (object != NULL); |
|
242 |
+ g_return_if_fail (ACME_IS_VOLUME (object)); |
|
243 |
+ |
|
244 |
+ self = ACME_VOLUME (object); |
|
245 |
+ |
|
246 |
+ if (self->_priv->timer_id != 0) |
|
247 |
+ g_source_remove (self->_priv->timer_id); |
|
248 |
+ acme_volume_close_real (self); |
|
249 |
+ |
|
250 |
+ if (self->_priv->gconf_client != NULL) { |
|
251 |
+ g_object_unref (self->_priv->gconf_client); |
|
252 |
+ self->_priv->gconf_client = NULL; |
|
253 |
+ } |
|
254 |
+ |
|
255 |
+ G_OBJECT_CLASS (acme_volume_parent_class)->finalize (object); |
|
256 |
+} |
|
257 |
+ |
|
258 |
+void |
|
259 |
+acme_volume_set_mute (AcmeVolume *self, gboolean val) |
|
260 |
+{ |
|
261 |
+ GList *t; |
|
262 |
+ |
|
263 |
+ g_return_if_fail(ACME_IS_VOLUME(self)); |
|
264 |
+ g_return_if_fail(acme_volume_open(self)); |
|
265 |
+ |
|
266 |
+ for (t = self->_priv->mixer_tracks; t != NULL; t = t->next) { |
|
267 |
+ GstMixerTrack *track = GST_MIXER_TRACK (t->data); |
|
268 |
+ gst_mixer_set_mute (self->_priv->mixer, track, val); |
|
269 |
+ } |
|
270 |
+ self->_priv->mute = val; |
|
271 |
+ acme_volume_close (self); |
|
272 |
+} |
|
273 |
+ |
|
274 |
+static void |
|
275 |
+update_state (AcmeVolume * self) |
|
276 |
+{ |
|
277 |
+ gint *volumes, n; |
|
278 |
+ gdouble vol = 0; |
|
279 |
+ GstMixerTrack *track = GST_MIXER_TRACK (self->_priv->mixer_tracks->data); |
|
280 |
+ |
|
281 |
+ /* update mixer by getting volume */ |
|
282 |
+ volumes = g_new0 (gint, track->num_channels); |
|
283 |
+ gst_mixer_get_volume (self->_priv->mixer, track, volumes); |
|
284 |
+ for (n = 0; n < track->num_channels; n++) |
|
285 |
+ vol += volumes[n]; |
|
286 |
+ g_free (volumes); |
|
287 |
+ vol /= track->num_channels; |
|
288 |
+ vol = 100 * vol / (track->max_volume - track->min_volume); |
|
289 |
+ |
|
290 |
+ /* update mute flag, and volume if not muted */ |
|
291 |
+ if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MUTE)) |
|
292 |
+ self->_priv->mute = TRUE; |
|
293 |
+ self->_priv->volume = vol; |
|
294 |
+} |
|
295 |
+ |
|
296 |
+gboolean |
|
297 |
+acme_volume_get_mute (AcmeVolume *self) |
|
298 |
+{ |
|
299 |
+ g_return_val_if_fail(acme_volume_open(self), FALSE); |
|
300 |
+ |
|
301 |
+ update_state (self); |
|
302 |
+ acme_volume_close (self); |
|
303 |
+ |
|
304 |
+ return self->_priv->mute; |
|
305 |
+} |
|
306 |
+ |
|
307 |
+gint |
|
308 |
+acme_volume_get_volume (AcmeVolume *self) |
|
309 |
+{ |
|
310 |
+ |
|
311 |
+ g_return_val_if_fail(acme_volume_open(self), 0); |
|
312 |
+ |
|
313 |
+ update_state (self); |
|
314 |
+ |
|
315 |
+ acme_volume_close (self); |
|
316 |
+ |
|
317 |
+ return (gint) (self->_priv->volume + 0.5); |
|
318 |
+} |
|
319 |
+ |
|
320 |
+void |
|
321 |
+acme_volume_set_volume (AcmeVolume *self, gint val) |
|
322 |
+{ |
|
323 |
+ GList *t; |
|
324 |
+ |
|
325 |
+ g_return_if_fail(acme_volume_open(self)); |
|
326 |
+ |
|
327 |
+ val = CLAMP (val, 0, 100); |
|
328 |
+ |
|
329 |
+ for (t = self->_priv->mixer_tracks; t != NULL; t = t->next) { |
|
330 |
+ GstMixerTrack *track = GST_MIXER_TRACK (t->data); |
|
331 |
+ gint *volumes, n; |
|
332 |
+ gdouble scale = (track->max_volume - track->min_volume) / 100.0; |
|
333 |
+ gint vol = (gint) (val * scale + track->min_volume + 0.5); |
|
334 |
+ |
|
335 |
+ volumes = g_new (gint, track->num_channels); |
|
336 |
+ for (n = 0; n < track->num_channels; n++) |
|
337 |
+ volumes[n] = vol; |
|
338 |
+ gst_mixer_set_volume (self->_priv->mixer, track, volumes); |
|
339 |
+ g_free (volumes); |
|
340 |
+ } |
|
341 |
+ |
|
342 |
+ /* update state */ |
|
343 |
+ self->_priv->volume = val; |
|
344 |
+ |
|
345 |
+ acme_volume_close (self); |
|
346 |
+} |
|
347 |
+ |
|
348 |
+void |
|
349 |
+acme_volume_mute_toggle (AcmeVolume *self) |
|
350 |
+{ |
|
351 |
+ gboolean muted; |
|
352 |
+ |
|
353 |
+ g_return_if_fail (self != NULL); |
|
354 |
+ g_return_if_fail (ACME_IS_VOLUME(self)); |
|
355 |
+ |
|
356 |
+ muted = acme_volume_get_mute(self); |
|
357 |
+ acme_volume_set_mute(self, !muted); |
|
358 |
+} |
|
359 |
+ |
|
360 |
+gint |
|
361 |
+acme_volume_get_threshold (AcmeVolume *self) |
|
362 |
+{ |
|
363 |
+ GList *t; |
|
364 |
+ gint steps = 101; |
|
365 |
+ |
|
366 |
+ g_return_val_if_fail(acme_volume_open(self), 1); |
|
367 |
+ |
|
368 |
+ for (t = self->_priv->mixer_tracks; t != NULL; t = t->next) { |
|
369 |
+ GstMixerTrack *track = GST_MIXER_TRACK (t->data); |
|
370 |
+ gint track_steps = track->max_volume - track->min_volume; |
|
371 |
+ if (track_steps > 0 && track_steps < steps) |
|
372 |
+ steps = track_steps; |
|
373 |
+ } |
|
374 |
+ |
|
375 |
+ acme_volume_close (self); |
|
376 |
+ |
|
377 |
+ return 100 / steps + 1; |
|
378 |
+} |
|
379 |
+ |
|
380 |
+static gboolean |
|
381 |
+acme_volume_close_real (AcmeVolume *self) |
|
382 |
+{ |
|
383 |
+ if (self->_priv->mixer != NULL) |
|
384 |
+ { |
|
385 |
+ gst_element_set_state (GST_ELEMENT (self->_priv->mixer), GST_STATE_NULL); |
|
386 |
+ gst_object_unref (GST_OBJECT (self->_priv->mixer)); |
|
387 |
+ g_list_foreach (self->_priv->mixer_tracks, (GFunc) g_object_unref, NULL); |
|
388 |
+ g_list_free (self->_priv->mixer_tracks); |
|
389 |
+ self->_priv->mixer = NULL; |
|
390 |
+ self->_priv->mixer_tracks = NULL; |
|
391 |
+ } |
|
392 |
+ |
|
393 |
+ self->_priv->timer_id = 0; |
|
394 |
+ return FALSE; |
|
395 |
+} |
|
396 |
+ |
|
397 |
+/* |
|
398 |
+ * _acme_set_mixer |
|
399 |
+ * @mixer A pointer to mixer element |
|
400 |
+ * @data A pointer to user data (AcmeVolume instance to be modified) |
|
401 |
+ * @return A gboolean indicating success if Master track was found, failed otherwises. |
|
402 |
+ */ |
|
403 |
+static gboolean |
|
404 |
+_acme_set_mixer(GstMixer *mixer, gpointer user_data) |
|
405 |
+{ |
|
406 |
+ GstElementFactory *factory; |
|
407 |
+ const GList *tracks; |
|
408 |
+ const gchar *long_name; |
|
409 |
+ gchar *devname = NULL; |
|
410 |
+ gchar *name; |
|
411 |
+ int p_count = 0; |
|
412 |
+ |
|
413 |
+ for (tracks = gst_mixer_list_tracks (mixer); tracks != NULL; tracks = tracks->next) { |
|
414 |
+ GstMixerTrack *track = GST_MIXER_TRACK (tracks->data); |
|
415 |
+ |
|
416 |
+ if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MASTER)) { |
|
417 |
+ AcmeVolume *self; |
|
418 |
+ |
|
419 |
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (mixer)), |
|
420 |
+ "device-name")) { |
|
421 |
+ g_object_get (mixer, "device-name", &devname, NULL); |
|
422 |
+ } else { |
|
423 |
+ devname = NULL; |
|
424 |
+ } |
|
425 |
+ |
|
426 |
+ factory = gst_element_get_factory (GST_ELEMENT (mixer)); |
|
427 |
+ long_name = gst_element_factory_get_longname (factory); |
|
428 |
+ |
|
429 |
+ if (devname) { |
|
430 |
+ name = g_strdup_printf ("%s (%s)", devname, long_name); |
|
431 |
+ g_free (devname); |
|
432 |
+ } else { |
|
433 |
+ gchar *title; |
|
434 |
+ |
|
435 |
+ p_count += 1; |
|
436 |
+ |
|
437 |
+ title = g_strdup_printf (_("Unknown Volume Control %d"), p_count); |
|
438 |
+ name = g_strdup_printf ("%s (%s)", title, long_name); |
|
439 |
+ g_free (title); |
|
440 |
+ |
|
441 |
+ } |
|
442 |
+ |
|
443 |
+ self = ACME_VOLUME (user_data); |
|
444 |
+ |
|
445 |
+ /* |
|
446 |
+ * Check to see if the mixer is the one defined as being used by |
|
447 |
+ * gnome-volume-control. If so, use this one. Otherwise return |
|
448 |
+ * the first one. |
|
449 |
+ */ |
|
450 |
+ if ((self->_priv->gvc_mixer != NULL && |
|
451 |
+ strcmp (name, self->_priv->gvc_mixer) == 0) || |
|
452 |
+ (self->_priv->found_mixer == FALSE)) { |
|
453 |
+ |
|
454 |
+ self->_priv->found_mixer = TRUE; |
|
455 |
+ |
|
456 |
+ if (self->_priv->mixer != NULL) { |
|
457 |
+ /* If we set a previous mixer, free it */ |
|
458 |
+ gst_element_set_state (GST_ELEMENT (self->_priv->mixer), GST_STATE_NULL); |
|
459 |
+ } |
|
460 |
+ |
|
461 |
+ self->_priv->mixer = mixer; |
|
462 |
+ |
|
463 |
+ /* Free any previously set mixer tracks */ |
|
464 |
+ if (self->_priv->mixer_tracks != NULL) { |
|
465 |
+ g_list_foreach (self->_priv->mixer_tracks, (GFunc) g_object_unref, NULL); |
|
466 |
+ g_list_free (self->_priv->mixer_tracks); |
|
467 |
+ self->_priv->mixer_tracks = NULL; |
|
468 |
+ } |
|
469 |
+ |
|
470 |
+ self->_priv->mixer_tracks = g_list_append (self->_priv->mixer_tracks, g_object_ref (track)); |
|
471 |
+ return TRUE; |
|
472 |
+ } else { |
|
473 |
+ return FALSE; |
|
474 |
+ } |
|
475 |
+ } |
|
476 |
+ |
|
477 |
+ continue; |
|
478 |
+ } |
|
479 |
+ |
|
480 |
+ return FALSE; |
|
481 |
+} |
|
482 |
+ |
|
483 |
+/* This is a modified version of code from gnome-media's gst-mixer */ |
|
484 |
+static gboolean |
|
485 |
+acme_volume_open (AcmeVolume *self) |
|
486 |
+{ |
|
487 |
+ gchar *mixer_device, **factory_and_device = NULL; |
|
488 |
+ GList *mixer_list; |
|
489 |
+ |
|
490 |
+ if (self->_priv->timer_id != 0) { |
|
491 |
+ g_source_remove (self->_priv->timer_id); |
|
492 |
+ self->_priv->timer_id = 0; |
|
493 |
+ return TRUE; |
|
494 |
+ } |
|
495 |
+ |
|
496 |
+ mixer_device = gconf_client_get_string (self->_priv->gconf_client, DEFAULT_MIXER_DEVICE_KEY, NULL); |
|
497 |
+ self->_priv->gvc_mixer = gconf_client_get_string (self->_priv->gconf_client, |
|
498 |
+ GNOME_VOLUME_CONTROL_KEY_ACTIVE_ELEMENT, |
|
499 |
+ NULL); |
|
500 |
+ |
|
501 |
+ if (mixer_device != NULL) |
|
502 |
+ factory_and_device = g_strsplit (mixer_device, ":", 2); |
|
503 |
+ |
|
504 |
+ if (factory_and_device != NULL && factory_and_device[0] != NULL) { |
|
505 |
+ GstElement *element; |
|
506 |
+ |
|
507 |
+ element = gst_element_factory_make (factory_and_device[0], NULL); |
|
508 |
+ |
|
509 |
+ if (element != NULL) { |
|
510 |
+ if (factory_and_device[1] != NULL && |
|
511 |
+ g_object_class_find_property (G_OBJECT_GET_CLASS (element), "device")) |
|
512 |
+ g_object_set (G_OBJECT (element), "device", factory_and_device[1], NULL); |
|
513 |
+ gst_element_set_state (element, GST_STATE_READY); |
|
514 |
+ |
|
515 |
+ if (GST_IS_MIXER (element)) |
|
516 |
+ self->_priv->mixer = GST_MIXER (element); |
|
517 |
+ else { |
|
518 |
+ gst_element_set_state (element, GST_STATE_NULL); |
|
519 |
+ gst_object_unref (element); |
|
520 |
+ } |
|
521 |
+ } |
|
522 |
+ } |
|
523 |
+ |
|
524 |
+ g_free (mixer_device); |
|
525 |
+ g_strfreev (factory_and_device); |
|
526 |
+ |
|
527 |
+ if (self->_priv->mixer != NULL) { |
|
528 |
+ const GList *m; |
|
529 |
+ GSList *tracks, *t; |
|
530 |
+ GError *error = NULL; |
|
531 |
+ |
|
532 |
+ /* Try to use tracks saved in GConf |
|
533 |
+ Note: errors need to be treated , for example if the user set a non type list for this key |
|
534 |
+ or if the elements type_list are not "matched" */ |
|
535 |
+ tracks = gconf_client_get_list (self->_priv->gconf_client, DEFAULT_MIXER_TRACKS_KEY, |
|
536 |
+ GCONF_VALUE_STRING, &error); |
|
537 |
+ |
|
538 |
+ if (error) { |
|
539 |
+ g_warning("ERROR: %s\n", error->message); |
|
540 |
+ g_error_free(error); |
|
541 |
+ } |
|
542 |
+ |
|
543 |
+ /* We use these tracks ONLY if they are supported on the system with the following mixer */ |
|
544 |
+ for (m = gst_mixer_list_tracks (self->_priv->mixer); m != NULL; m = m->next) { |
|
545 |
+ GstMixerTrack *track = GST_MIXER_TRACK (m->data); |
|
546 |
+ |
|
547 |
+ for (t = tracks; t != NULL; t = t->next) |
|
548 |
+ if (!strcmp (t->data, track->label)) |
|
549 |
+ self->_priv->mixer_tracks = g_list_append (self->_priv->mixer_tracks, g_object_ref (track)); |
|
550 |
+ |
|
551 |
+ } |
|
552 |
+ |
|
553 |
+ g_slist_foreach (tracks, (GFunc)g_free, NULL); |
|
554 |
+ g_slist_free (tracks); |
|
555 |
+ |
|
556 |
+ /* If no track stored in GConf is avaiable try to use Master track */ |
|
557 |
+ if (self->_priv->mixer_tracks == NULL) { |
|
558 |
+ for (m = gst_mixer_list_tracks (self->_priv->mixer); m != NULL; m = m->next) { |
|
559 |
+ GstMixerTrack *track = GST_MIXER_TRACK (m->data); |
|
560 |
+ |
|
561 |
+ if (GST_MIXER_TRACK_HAS_FLAG (track, GST_MIXER_TRACK_MASTER)) { |
|
562 |
+ self->_priv->mixer_tracks = g_list_append (self->_priv->mixer_tracks, g_object_ref (track)); |
|
563 |
+ break; |
|
564 |
+ } |
|
565 |
+ } |
|
566 |
+ } |
|
567 |
+ |
|
568 |
+ if (self->_priv->mixer_tracks != NULL) |
|
569 |
+ return TRUE; |
|
570 |
+ else { |
|
571 |
+ gst_element_set_state (GST_ELEMENT (self->_priv->mixer), GST_STATE_NULL); |
|
572 |
+ gst_object_unref (self->_priv->mixer); |
|
573 |
+ } |
|
574 |
+ } |
|
575 |
+ |
|
576 |
+ /* Go through all elements of a certain class and check whether |
|
577 |
+ * they implement a mixer. If so, walk through the tracks and look |
|
578 |
+ * for first one named "volume". |
|
579 |
+ * |
|
580 |
+ * We should probably do something intelligent if we don't find an |
|
581 |
+ * appropriate mixer/track. But now we do something stupid... |
|
582 |
+ * everything just becomes a no-op. |
|
583 |
+ */ |
|
584 |
+ self->_priv->mixer = NULL; |
|
585 |
+ self->_priv->found_mixer = FALSE; |
|
586 |
+ mixer_list = gst_audio_default_registry_mixer_filter (_acme_set_mixer, |
|
587 |
+ FALSE, |
|
588 |
+ self); |
|
589 |
+ |
|
590 |
+ if (mixer_list == NULL) |
|
591 |
+ return FALSE; |
|
592 |
+ |
|
593 |
+ /* do not unref the mixer as we keep the ref for self->priv->mixer */ |
|
594 |
+ g_list_free (mixer_list); |
|
595 |
+ |
|
596 |
+ return TRUE; |
|
597 |
+} |
|
598 |
+ |
|
599 |
+static void |
|
600 |
+acme_volume_close (AcmeVolume *self) |
|
601 |
+{ |
|
602 |
+ self->_priv->timer_id = g_timeout_add_seconds (TIMEOUT, |
|
603 |
+ (GSourceFunc) acme_volume_close_real, self); |
|
604 |
+} |
|
605 |
+ |
|
606 |
+static void |
|
607 |
+acme_volume_init (AcmeVolume *self) |
|
608 |
+{ |
|
609 |
+ self->_priv = ACME_VOLUME_GET_PRIVATE (self); |
|
610 |
+ self->_priv->gconf_client = gconf_client_get_default (); |
|
611 |
+ self->_priv->gvc_mixer = NULL; |
|
612 |
+} |
|
613 |
+ |
|
614 |
+static void |
|
615 |
+acme_volume_class_init (AcmeVolumeClass *klass) |
|
616 |
+{ |
|
617 |
+ G_OBJECT_CLASS (klass)->finalize = acme_volume_finalize; |
|
618 |
+ |
|
619 |
+ gst_init (NULL, NULL); |
|
620 |
+ |
|
621 |
+ g_type_class_add_private (klass, sizeof (AcmeVolumePrivate)); |
|
622 |
+} |
|
623 |
+ |
|
624 |
+/* acme_volume_new |
|
625 |
+ * @return A singleton instance of type AcmeVolume |
|
626 |
+ */ |
|
627 |
+AcmeVolume * |
|
628 |
+acme_volume_new (void) |
|
629 |
+{ |
|
630 |
+ if (acme_volume_object == NULL) { |
|
631 |
+ acme_volume_object = g_object_new (ACME_TYPE_VOLUME, NULL); |
|
632 |
+ return ACME_VOLUME(acme_volume_object); |
|
633 |
+ } |
|
634 |
+ g_object_ref(acme_volume_object); |
|
635 |
+ return ACME_VOLUME(acme_volume_object); |
|
636 |
+} |
|
637 |
+ |
|
638 |
diff --git a/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.h b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.h |
|
639 |
new file mode 100644 |
|
640 |
index 0000000..c14ebc8 |
|
641 |
--- /dev/null |
|
642 |
+++ b/plugins/media-keys/cut-n-paste/gvc-gstreamer-acme-vol.h |
|
643 |
@@ -0,0 +1,56 @@ |
|
644 |
+/* acme-volume.h |
|
645 |
+ |
|
646 |
+ Copyright (C) 2002, 2003 Bastien Nocera |
|
647 |
+ Copyright (C) 2004 Novell, Inc. |
|
648 |
+ Copyright (C) 2009 PERIER Romain <[email protected]> |
|
649 |
+ |
|
650 |
+ The Gnome Library is free software; you can redistribute it and/or |
|
651 |
+ modify it under the terms of the GNU Library General Public License as |
|
652 |
+ published by the Free Software Foundation; either version 2 of the |
|
653 |
+ License, or (at your option) any later version. |
|
654 |
+ |
|
655 |
+ The Gnome Library is distributed in the hope that it will be useful, |
|
656 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
657 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
658 |
+ Library General Public License for more details. |
|
659 |
+ |
|
660 |
+ You should have received a copy of the GNU Library General Public |
|
661 |
+ License along with the Gnome Library; see the file COPYING.LIB. If not, |
|
662 |
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
663 |
+ Boston, MA 02111-1307, USA. |
|
664 |
+ |
|
665 |
+ Author: Bastien Nocera <[email protected]> |
|
666 |
+ Jon Trowbridge <[email protected]> |
|
667 |
+ */ |
|
668 |
+ |
|
669 |
+#include <glib-object.h> |
|
670 |
+ |
|
671 |
+#define ACME_TYPE_VOLUME (acme_volume_get_type ()) |
|
672 |
+#define ACME_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME, AcmeVolume)) |
|
673 |
+#define ACME_VOLUME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME, AcmeVolumeClass)) |
|
674 |
+#define ACME_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME)) |
|
675 |
+#define ACME_VOLUME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME, AcmeVolumeClass)) |
|
676 |
+ |
|
677 |
+typedef struct AcmeVolume AcmeVolume; |
|
678 |
+typedef struct AcmeVolumeClass AcmeVolumeClass; |
|
679 |
+typedef struct AcmeVolumePrivate AcmeVolumePrivate; |
|
680 |
+ |
|
681 |
+struct AcmeVolume { |
|
682 |
+ GObject parent; |
|
683 |
+ AcmeVolumePrivate *_priv; |
|
684 |
+}; |
|
685 |
+ |
|
686 |
+struct AcmeVolumeClass { |
|
687 |
+ GObjectClass parent; |
|
688 |
+}; |
|
689 |
+ |
|
690 |
+GType acme_volume_get_type (void); |
|
691 |
+AcmeVolume *acme_volume_new (void); |
|
692 |
+void acme_volume_set_mute (AcmeVolume *self, gboolean val); |
|
693 |
+void acme_volume_mute_toggle (AcmeVolume *self); |
|
694 |
+gboolean acme_volume_get_mute (AcmeVolume *self); |
|
695 |
+void acme_volume_set_volume (AcmeVolume *self, gint val); |
|
696 |
+gint acme_volume_get_volume (AcmeVolume *self); |
|
697 |
+gint acme_volume_get_threshold (AcmeVolume *self); |
|
698 |
+ |
|
699 |
+ |
|
700 |
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c |
|
701 |
--- a/plugins/media-keys/gsd-media-keys-manager.c |
|
702 |
+++ b/plugins/media-keys/gsd-media-keys-manager.c |
|
703 |
@@ -53,6 +53,8 @@ |
|
704 |
#ifdef HAVE_PULSE |
|
705 |
#include <canberra-gtk.h> |
|
706 |
#include "gvc-mixer-control.h" |
|
707 |
+#elif defined(HAVE_GSTREAMER) |
|
708 |
+#include "gvc-gstreamer-acme-vol.h" |
|
709 |
#endif /* HAVE_PULSE */ |
|
710 |
||
711 |
#define GSD_DBUS_PATH "/org/gnome/SettingsDaemon" |
|
712 |
@@ -78,6 +80,8 @@ struct GsdMediaKeysManagerPrivate |
|
713 |
/* Volume bits */ |
|
714 |
GvcMixerControl *volume; |
|
715 |
GvcMixerStream *stream; |
|
716 |
+#elif defined(HAVE_GSTREAMER) |
|
717 |
+ AcmeVolume *volume; |
|
718 |
#endif /* HAVE_PULSE */ |
|
719 |
GtkWidget *dialog; |
|
720 |
GConfClient *conf_client; |
|
721 |
@@ -707,7 +711,9 @@ update_dialog (GsdMediaKeysManager *mana |
|
722 |
CA_PROP_APPLICATION_ID, "org.gnome.VolumeControl", |
|
723 |
NULL); |
|
724 |
} |
|
725 |
+#endif /* HAVE_PULSE */ |
|
726 |
||
727 |
+#if defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) |
|
728 |
static void |
|
729 |
do_sound_action (GsdMediaKeysManager *manager, |
|
730 |
int type) |
|
731 |
@@ -715,9 +721,13 @@ do_sound_action (GsdMediaKeysManager *ma |
|
732 |
gboolean muted; |
|
733 |
guint vol, norm_vol_step; |
|
734 |
int vol_step; |
|
735 |
+#ifdef HAVE_PULSE |
|
736 |
gboolean sound_changed; |
|
737 |
||
738 |
if (manager->priv->stream == NULL) |
|
739 |
+#else |
|
740 |
+ if (manager->priv->volume == NULL) |
|
741 |
+#endif |
|
742 |
return; |
|
743 |
||
744 |
vol_step = gconf_client_get_int (manager->priv->conf_client, |
|
745 |
@@ -727,20 +737,39 @@ do_sound_action (GsdMediaKeysManager *ma |
|
746 |
if (vol_step <= 0 || vol_step > 100) |
|
747 |
vol_step = VOLUME_STEP; |
|
748 |
||
749 |
+#ifdef HAVE_PULSE |
|
750 |
norm_vol_step = PA_VOLUME_NORM * vol_step / 100; |
|
751 |
||
752 |
/* FIXME: this is racy */ |
|
753 |
vol = gvc_mixer_stream_get_volume (manager->priv->stream); |
|
754 |
muted = gvc_mixer_stream_get_is_muted (manager->priv->stream); |
|
755 |
+#else |
|
756 |
+ if (vol_step > 0) { |
|
757 |
+ gint threshold = acme_volume_get_threshold (manager->priv->volume); |
|
758 |
+ if (vol_step < threshold) |
|
759 |
+ vol_step = threshold; |
|
760 |
+ g_debug ("Using volume step of %d", vol_step); |
|
761 |
+ } |
|
762 |
+ vol = acme_volume_get_volume (manager->priv->volume); |
|
763 |
+ muted = acme_volume_get_mute (manager->priv->volume); |
|
764 |
+#endif |
|
765 |
+ |
|
766 |
+#ifdef HAVE_PULSE |
|
767 |
sound_changed = FALSE; |
|
768 |
+#endif |
|
769 |
||
770 |
switch (type) { |
|
771 |
case MUTE_KEY: |
|
772 |
+#ifdef HAVE_PULSE |
|
773 |
muted = !muted; |
|
774 |
gvc_mixer_stream_change_is_muted (manager->priv->stream, muted); |
|
775 |
sound_changed = TRUE; |
|
776 |
+#else |
|
777 |
+ acme_volume_mute_toggle (manager->priv->volume); |
|
778 |
+#endif |
|
779 |
break; |
|
780 |
case VOLUME_DOWN_KEY: |
|
781 |
+#ifdef HAVE_PULSE |
|
782 |
if (!muted && (vol <= norm_vol_step)) { |
|
783 |
muted = !muted; |
|
784 |
vol = 0; |
|
785 |
@@ -756,9 +785,15 @@ do_sound_action (GsdMediaKeysManager *ma |
|
786 |
sound_changed = TRUE; |
|
787 |
} |
|
788 |
} |
|
789 |
+#else |
|
790 |
+ if (!muted && (vol <= vol_step)) |
|
791 |
+ acme_volume_mute_toggle (manager->priv->volume); |
|
792 |
+ acme_volume_set_volume (manager->priv->volume, vol - vol_step); |
|
793 |
+#endif |
|
794 |
break; |
|
795 |
case VOLUME_UP_KEY: |
|
796 |
if (muted) { |
|
797 |
+#ifdef HAVE_PULSE |
|
798 |
muted = !muted; |
|
799 |
if (vol == 0) { |
|
800 |
vol = vol + norm_vol_step; |
|
801 |
@@ -771,7 +806,16 @@ do_sound_action (GsdMediaKeysManager *ma |
|
802 |
gvc_mixer_stream_change_is_muted (manager->priv->stream, muted); |
|
803 |
sound_changed = TRUE; |
|
804 |
} |
|
805 |
+#else |
|
806 |
+ if (vol == 0) { |
|
807 |
+ /* We need to unmute otherwise vol is blocked (and muted) */ |
|
808 |
+ acme_volume_set_mute (manager->priv->volume, FALSE); |
|
809 |
+ } |
|
810 |
+ acme_volume_set_volume (manager->priv->volume, vol + vol_step); |
|
811 |
+ |
|
812 |
+#endif |
|
813 |
} else { |
|
814 |
+#ifdef HAVE_PULSE |
|
815 |
if (vol < MAX_VOLUME) { |
|
816 |
if (vol + norm_vol_step >= MAX_VOLUME) { |
|
817 |
vol = MAX_VOLUME; |
|
818 |
@@ -783,13 +827,34 @@ do_sound_action (GsdMediaKeysManager *ma |
|
819 |
sound_changed = TRUE; |
|
820 |
} |
|
821 |
} |
|
822 |
+#else |
|
823 |
+ acme_volume_set_volume (manager->priv->volume, vol + vol_step); |
|
824 |
+#endif |
|
825 |
} |
|
826 |
break; |
|
827 |
} |
|
828 |
||
829 |
+#ifdef HAVE_PULSE |
|
830 |
update_dialog (manager, vol, muted, sound_changed); |
|
831 |
+#else |
|
832 |
+ muted = acme_volume_get_mute (manager->priv->volume); |
|
833 |
+ vol = acme_volume_get_volume (manager->priv->volume); |
|
834 |
+ |
|
835 |
+ /* FIXME: AcmeVolume should probably emit signals |
|
836 |
+ instead of doing it like this */ |
|
837 |
+ dialog_init (manager); |
|
838 |
+ gsd_media_keys_window_set_volume_muted (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog), |
|
839 |
+ muted); |
|
840 |
+ gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog), |
|
841 |
+ vol); |
|
842 |
+ gsd_media_keys_window_set_action (GSD_MEDIA_KEYS_WINDOW (manager->priv->dialog), |
|
843 |
+ GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME); |
|
844 |
+ dialog_show (manager); |
|
845 |
+#endif /* HAVE_PULSE */ |
|
846 |
} |
|
847 |
+#endif /* defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) */ |
|
848 |
||
849 |
+#ifdef HAVE_PULSE |
|
850 |
static void |
|
851 |
update_default_sink (GsdMediaKeysManager *manager) |
|
852 |
{ |
|
853 |
@@ -951,9 +1016,9 @@ do_action (GsdMediaKeysManager *manager, |
|
854 |
case MUTE_KEY: |
|
855 |
case VOLUME_DOWN_KEY: |
|
856 |
case VOLUME_UP_KEY: |
|
857 |
-#ifdef HAVE_PULSE |
|
858 |
+#if defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) |
|
859 |
do_sound_action (manager, type); |
|
860 |
-#endif /* HAVE_PULSE */ |
|
861 |
+#endif /* HAVE_PULSE || HAVE_GSTREAMER */ |
|
862 |
break; |
|
863 |
case POWER_KEY: |
|
864 |
do_exit_action (manager); |
|
865 |
@@ -1157,6 +1222,10 @@ gsd_media_keys_manager_start (GsdMediaKe |
|
866 |
gvc_mixer_control_open (manager->priv->volume); |
|
867 |
||
868 |
gnome_settings_profile_end ("gvc_mixer_control_new"); |
|
869 |
+#elif defined(HAVE_GSTREAMER) |
|
870 |
+ gnome_settings_profile_start ("acme_volume_new"); |
|
871 |
+ manager->priv->volume = acme_volume_new (); |
|
872 |
+ gnome_settings_profile_end ("acme_volume_new"); |
|
873 |
#endif /* HAVE_PULSE */ |
|
874 |
g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager); |
|
875 |
||
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
876 |
@@ -1234,12 +1303,14 @@ gsd_media_keys_manager_stop (GsdMediaKey |
17844 | 877 |
g_object_unref (priv->stream); |
878 |
priv->stream = NULL; |
|
879 |
} |
|
880 |
+#endif /* HAVE_PULSE */ |
|
881 |
||
882 |
+#if defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) |
|
883 |
if (priv->volume) { |
|
884 |
g_object_unref (priv->volume); |
|
885 |
priv->volume = NULL; |
|
18220
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
886 |
} |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
887 |
-#endif /* HAVE_PULSE */ |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
888 |
+#endif /* defined(HAVE_PULSE) || defined(HAVE_GSTREAMER) */ |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
889 |
|
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
890 |
if (priv->dialog != NULL) { |
14c4093b6689
Minor changes to the patch to make it match the patch proposed upstream.
yippi
parents:
17845
diff
changeset
|
891 |
gtk_widget_destroy (priv->dialog); |