static void gst_video_balance_colorbalance_set_value (GstColorBalance * balance, GstColorBalanceChannel * channel, gint value) { GstVideoBalance *vb = GST_VIDEO_BALANCE (balance); gdouble new_val; gboolean changed = FALSE; g_return_if_fail (vb != NULL); g_return_if_fail (GST_IS_VIDEO_BALANCE (vb)); g_return_if_fail (GST_IS_VIDEO_FILTER (vb)); g_return_if_fail (channel->label != NULL); GST_BASE_TRANSFORM_LOCK (vb); GST_OBJECT_LOCK (vb); if (!g_ascii_strcasecmp (channel->label, "HUE")) { new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0; changed = new_val != vb->hue; vb->hue = new_val; } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) { new_val = (value + 1000.0) * 2.0 / 2000.0; changed = new_val != vb->saturation; vb->saturation = new_val; } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) { new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0; changed = new_val != vb->brightness; vb->brightness = new_val; } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) { new_val = (value + 1000.0) * 2.0 / 2000.0; changed = new_val != vb->contrast; vb->contrast = new_val; } if (changed) gst_video_balance_update_properties (vb); GST_OBJECT_UNLOCK (vb); GST_BASE_TRANSFORM_UNLOCK (vb); if (changed) { gst_color_balance_value_changed (balance, channel, gst_color_balance_get_value (balance, channel)); } }
static void gst_video_balance_colorbalance_set_value (GstColorBalance * balance, GstColorBalanceChannel * channel, gint value) { GstVideoBalance *vb = GST_VIDEO_BALANCE (balance); g_return_if_fail (vb != NULL); g_return_if_fail (GST_IS_VIDEO_BALANCE (vb)); g_return_if_fail (GST_IS_VIDEO_FILTER (vb)); g_return_if_fail (channel->label != NULL); if (!g_ascii_strcasecmp (channel->label, "HUE")) { vb->hue = (value + 1000.0) * 2.0 / 2000.0 - 1.0; } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) { vb->saturation = (value + 1000.0) * 2.0 / 2000.0; } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) { vb->brightness = (value + 1000.0) * 2.0 / 2000.0 - 1.0; } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) { vb->contrast = (value + 1000.0) * 2.0 / 2000.0; } gst_video_balance_update_properties (vb); }