summaryrefslogtreecommitdiff
path: root/libbanshee
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd@luon.net>2011-03-13 14:17:36 +0000
committerGabriel Burt <gabriel.burt@gmail.com>2011-04-07 16:35:10 -0500
commit24d492cb8273718ff69188029a2cd2fc7fbdf7f0 (patch)
tree4c780df8ccbefcad2883bad1e0371dbb79e1fe55 /libbanshee
parent550b3be2e24583092730e4fd53c32942a8aace90 (diff)
libbanshee: Use the proper element for volume control (bgo#644648)
https://bugzilla.gnome.org/show_bug.cgi?id=644648 Signed-off-by: Gabriel Burt <gabriel.burt@gmail.com>
Diffstat (limited to 'libbanshee')
-rw-r--r--libbanshee/banshee-player.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libbanshee/banshee-player.c b/libbanshee/banshee-player.c
index 6ac8c7e3d..2e5999299 100644
--- a/libbanshee/banshee-player.c
+++ b/libbanshee/banshee-player.c
@@ -326,17 +326,34 @@ bp_set_volume (BansheePlayer *player, gdouble volume)
{
GParamSpec *volume_spec;
GValue value = { 0, };
+ GstElement *v;
g_return_if_fail (IS_BANSHEE_PLAYER (player));
- g_return_if_fail (GST_IS_ELEMENT(player->volume));
+
+ // playbin will either control the volume property of the audiosinks real
+ // sink element case the audiosink doesn't have one it will control a
+ // volume element it created itself.
+ // Unfortunately if playbin creates a volume element it will be before our
+ // audiosink and thus before our equalizer and replaygain, which is
+ // undesirable because of latency issues (Most likely they insert too many
+ // queues). So only use the playbin volume support when we know our sink
+ // supports volume control
+
+ if (player->audiosink_has_volume) {
+ v = player->playbin;
+ } else {
+ v = player->volume;
+ }
+
+ g_return_if_fail (GST_IS_ELEMENT(v));
player->current_volume = CLAMP (volume, 0.0, 1.0);
- volume_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (player->volume), "volume");
+ volume_spec = g_object_class_find_property (G_OBJECT_GET_CLASS (v), "volume");
g_value_init (&value, G_TYPE_DOUBLE);
g_value_set_double (&value, player->current_volume);
g_param_value_validate (volume_spec, &value);
- g_object_set_property (G_OBJECT (player->volume), "volume", &value);
+ g_object_set_property (G_OBJECT (v), "volume", &value);
g_value_unset (&value);
_bp_rgvolume_print_volume(player);
}