[banshee] libbanshee: Use the proper element for volume control (bgo#644648)



commit 24d492cb8273718ff69188029a2cd2fc7fbdf7f0
Author: Sjoerd Simons <sjoerd luon net>
Date:   Sun Mar 13 14:17:36 2011 +0000

    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>

 libbanshee/banshee-player.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/libbanshee/banshee-player.c b/libbanshee/banshee-player.c
index 6ac8c7e..2e59992 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);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]