aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-audio-sink.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-02-17 05:25:31 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-02-17 05:25:31 +0800
commit2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c (patch)
tree88c3593e08d036833e75114fd1dd2fd96b6087d2 /libempathy-gtk/empathy-audio-sink.c
parent28fcd89487b7f27a2f4e883ca54848c0280c3980 (diff)
downloadgsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar.gz
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar.bz2
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar.lz
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar.xz
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.tar.zst
gsoc2013-empathy-2f7ab55f4ba0977db7bcf55a339d3b971c32cc9c.zip
When finding a better element to use for volume, reset the current one and transfer the volume changes to the new one
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> svn path=/trunk/; revision=2492
Diffstat (limited to 'libempathy-gtk/empathy-audio-sink.c')
-rw-r--r--libempathy-gtk/empathy-audio-sink.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-audio-sink.c b/libempathy-gtk/empathy-audio-sink.c
index d304a2676..83a14d4be 100644
--- a/libempathy-gtk/empathy-audio-sink.c
+++ b/libempathy-gtk/empathy-audio-sink.c
@@ -64,9 +64,19 @@ empathy_audio_sink_element_added_cb (FsElementAddedNotifier *notifier,
{
EmpathyGstAudioSinkPrivate *priv = EMPATHY_GST_AUDIO_SINK_GET_PRIVATE (self);
- if (g_object_class_find_property (G_OBJECT_CLASS (element), "volume"))
+ if (g_object_class_find_property (G_OBJECT_GET_CLASS (element), "volume"))
{
- priv->volume = element;
+ gdouble volume;
+
+ volume = empathy_audio_sink_get_volume (self);
+ empathy_audio_sink_set_volume (self, 1.0);
+
+ if (priv->volume != NULL)
+ g_object_unref (priv->volume);
+ priv->volume = g_object_ref (element);
+
+ if (volume != 1.0)
+ empathy_audio_sink_set_volume (self, volume);
}
}
@@ -82,7 +92,10 @@ empathy_audio_sink_init (EmpathyGstAudioSink *obj)
G_CALLBACK (empathy_audio_sink_element_added_cb), obj);
resample = gst_element_factory_make ("audioresample", NULL);
+
priv->volume = gst_element_factory_make ("volume", NULL);
+ g_object_ref (priv->volume);
+
priv->sink = gst_element_factory_make ("gconfaudiosink", NULL);
fs_element_added_notifier_add (priv->notifier, GST_BIN (priv->sink));
@@ -171,6 +184,9 @@ empathy_audio_sink_dispose (GObject *object)
g_object_unref (priv->notifier);
priv->notifier = NULL;
+ if (priv->volume != NULL)
+ g_object_unref (priv->volume);
+ priv->volume = NULL;
if (G_OBJECT_CLASS (empathy_audio_sink_parent_class)->dispose)
G_OBJECT_CLASS (empathy_audio_sink_parent_class)->dispose (object);