mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
videobalance: Emit "value-changed" signal of color balance interface when values change
This commit is contained in:
parent
e13cd55fab
commit
ea06bd33f8
1 changed files with 30 additions and 0 deletions
|
@ -518,36 +518,59 @@ gst_video_balance_colorbalance_init (GstColorBalanceClass * iface)
|
||||||
iface->get_value = gst_video_balance_colorbalance_get_value;
|
iface->get_value = gst_video_balance_colorbalance_get_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstColorBalanceChannel *
|
||||||
|
gst_video_balance_find_channel (GstVideoBalance * balance, const gchar * label)
|
||||||
|
{
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
for (l = balance->channels; l; l = l->next) {
|
||||||
|
GstColorBalanceChannel *channel = l->data;
|
||||||
|
|
||||||
|
if (g_ascii_strcasecmp (channel->label, label) == 0)
|
||||||
|
return channel;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_video_balance_set_property (GObject * object, guint prop_id,
|
gst_video_balance_set_property (GObject * object, guint prop_id,
|
||||||
const GValue * value, GParamSpec * pspec)
|
const GValue * value, GParamSpec * pspec)
|
||||||
{
|
{
|
||||||
GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
|
GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
|
||||||
gdouble d;
|
gdouble d;
|
||||||
|
const gchar *label = NULL;
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CONTRAST:
|
case PROP_CONTRAST:
|
||||||
d = g_value_get_double (value);
|
d = g_value_get_double (value);
|
||||||
GST_DEBUG_OBJECT (balance, "Changing contrast from %lf to %lf",
|
GST_DEBUG_OBJECT (balance, "Changing contrast from %lf to %lf",
|
||||||
balance->contrast, d);
|
balance->contrast, d);
|
||||||
|
if (d != balance->contrast)
|
||||||
|
label = "CONTRAST";
|
||||||
balance->contrast = d;
|
balance->contrast = d;
|
||||||
break;
|
break;
|
||||||
case PROP_BRIGHTNESS:
|
case PROP_BRIGHTNESS:
|
||||||
d = g_value_get_double (value);
|
d = g_value_get_double (value);
|
||||||
GST_DEBUG_OBJECT (balance, "Changing brightness from %lf to %lf",
|
GST_DEBUG_OBJECT (balance, "Changing brightness from %lf to %lf",
|
||||||
balance->brightness, d);
|
balance->brightness, d);
|
||||||
|
if (d != balance->brightness)
|
||||||
|
label = "BRIGHTNESS";
|
||||||
balance->brightness = d;
|
balance->brightness = d;
|
||||||
break;
|
break;
|
||||||
case PROP_HUE:
|
case PROP_HUE:
|
||||||
d = g_value_get_double (value);
|
d = g_value_get_double (value);
|
||||||
GST_DEBUG_OBJECT (balance, "Changing hue from %lf to %lf", balance->hue,
|
GST_DEBUG_OBJECT (balance, "Changing hue from %lf to %lf", balance->hue,
|
||||||
d);
|
d);
|
||||||
|
if (d != balance->hue)
|
||||||
|
label = "HUE";
|
||||||
balance->hue = d;
|
balance->hue = d;
|
||||||
break;
|
break;
|
||||||
case PROP_SATURATION:
|
case PROP_SATURATION:
|
||||||
d = g_value_get_double (value);
|
d = g_value_get_double (value);
|
||||||
GST_DEBUG_OBJECT (balance, "Changing saturation from %lf to %lf",
|
GST_DEBUG_OBJECT (balance, "Changing saturation from %lf to %lf",
|
||||||
balance->saturation, d);
|
balance->saturation, d);
|
||||||
|
if (d != balance->saturation)
|
||||||
|
label = "SATURATION";
|
||||||
balance->saturation = d;
|
balance->saturation = d;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -556,6 +579,13 @@ gst_video_balance_set_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_video_balance_update_properties (balance);
|
gst_video_balance_update_properties (balance);
|
||||||
|
|
||||||
|
if (label) {
|
||||||
|
GstColorBalanceChannel *channel =
|
||||||
|
gst_video_balance_find_channel (balance, label);
|
||||||
|
gst_color_balance_value_changed (GST_COLOR_BALANCE (balance), channel,
|
||||||
|
gst_color_balance_get_value (GST_COLOR_BALANCE (balance), channel));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue