Blame SOURCES/0001-gstplaysink-pass-translated-color-balance-value-to-c.patch

16c940
From 2731012d832b593c54a50492a27d328f2de9b596 Mon Sep 17 00:00:00 2001
16c940
From: Daniel Drake <dsd@laptop.org>
16c940
Date: Wed, 29 May 2013 10:33:48 -0600
16c940
Subject: [PATCH] gstplaysink: pass translated color balance value to channel
16c940
MIME-Version: 1.0
16c940
Content-Type: text/plain; charset=UTF-8
16c940
Content-Transfer-Encoding: 8bit
16c940
16c940
We found a case where untranslated values were being passed from the
16c940
proxy to the underlying channel, causing bad color balance values
16c940
in some setups.
16c940
16c940
Thanks to Sebastian Dröge for clarifying how the code works, and
16c940
suggesting the fix.
16c940
16c940
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=701202
16c940
---
16c940
 gst/playback/gstplaysink.c | 13 ++++++++++++-
16c940
 1 file changed, 12 insertions(+), 1 deletion(-)
16c940
16c940
Index: gst-plugins-base-1.0.7/gst/playback/gstplaysink.c
16c940
===================================================================
16c940
--- gst-plugins-base-1.0.7.orig/gst/playback/gstplaysink.c
16c940
+++ gst-plugins-base-1.0.7/gst/playback/gstplaysink.c
16c940
@@ -1540,6 +1540,7 @@ update_colorbalance (GstPlaySink * plays
16c940
     GstColorBalanceChannel *proxy = l->data;
16c940
     GstColorBalanceChannel *channel = NULL;
16c940
     const GList *channels, *k;
16c940
+    gdouble new_val;
16c940
 
16c940
     channels = gst_color_balance_list_channels (balance);
16c940
     for (k = channels; k; k = k->next) {
16c940
@@ -1553,8 +1554,18 @@ update_colorbalance (GstPlaySink * plays
16c940
 
16c940
     g_assert (channel);
16c940
 
16c940
+    /* Convert to [0, 1] range */
16c940
+    new_val =
16c940
+        ((gdouble) playsink->colorbalance_values[i] -
16c940
+        (gdouble) proxy->min_value) / ((gdouble) proxy->max_value -
16c940
+        (gdouble) proxy->min_value);
16c940
+    /* Convert to channel range */
16c940
+    new_val =
16c940
+        channel->min_value + new_val * ((gdouble) channel->max_value -
16c940
+        (gdouble) channel->min_value);
16c940
+
16c940
     gst_color_balance_set_value (balance, channel,
16c940
-        playsink->colorbalance_values[i]);
16c940
+        (gint) (new_val + 0.5));
16c940
   }
16c940
 
16c940
   g_signal_handlers_unblock_by_func (balance,