[totem/gnome-2-28] Use Cubic volume when StreaVolume interface is available
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [totem/gnome-2-28] Use Cubic volume when StreaVolume interface is available
- Date: Mon, 19 Oct 2009 14:45:58 +0000 (UTC)
commit afa4390023494baee01accb2160cac50e2f0644c
Author: Bastien Nocera <hadess hadess net>
Date: Mon Oct 19 15:40:29 2009 +0100
Use Cubic volume when StreaVolume interface is available
Fixes Totem's sound not matching the volume levels advertised
in pavucontrol and gnome-volume-control.
https://bugzilla.gnome.org/show_bug.cgi?id=595304
src/backend/bacon-video-widget-gst-0.10.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 314d101..8425897 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -54,6 +54,8 @@
#include <gst/audio/gstbaseaudiosink.h>
/* for pretty multichannel strings */
#include <gst/audio/multichannel.h>
+/* for the volume property */
+#include <gst/interfaces/streamvolume.h>
/* for missing decoder/demuxer detection */
#include <gst/pbutils/pbutils.h>
@@ -3894,8 +3896,14 @@ bacon_video_widget_set_volume (BaconVideoWidget * bvw, double volume)
gst_element_get_state (bvw->priv->pulse_audio_sink, &cur_state, NULL, 0);
if (cur_state == GST_STATE_READY || cur_state == GST_STATE_PLAYING)
{
- g_object_set (bvw->priv->pulse_audio_sink, "volume",
- (gdouble) volume, NULL);
+ if (gst_element_implements_interface (bvw->priv->pulse_audio_sink,
+ GST_TYPE_STREAM_VOLUME)) {
+ gst_stream_volume_set_volume (GST_STREAM_VOLUME (bvw->priv->pulse_audio_sink),
+ GST_STREAM_VOLUME_FORMAT_CUBIC,
+ volume);
+ } else {
+ g_object_set (bvw->priv->pulse_audio_sink, "volume", volume, NULL);
+ }
}
} else {
g_object_set (bvw->priv->play, "volume",
@@ -4626,7 +4634,13 @@ notify_volume_idle_cb (BaconVideoWidget *bvw)
{
gdouble vol;
- g_object_get (G_OBJECT (bvw->priv->pulse_audio_sink), "volume", &vol, NULL);
+ if (gst_element_implements_interface (bvw->priv->pulse_audio_sink,
+ GST_TYPE_STREAM_VOLUME)) {
+ vol = gst_stream_volume_get_volume (GST_STREAM_VOLUME (bvw->priv->pulse_audio_sink),
+ GST_STREAM_VOLUME_FORMAT_CUBIC);
+ } else {
+ g_object_get (G_OBJECT (bvw->priv->pulse_audio_sink), "volume", &vol, NULL);
+ }
bvw->priv->volume = vol;
g_object_notify (G_OBJECT (bvw), "volume");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]