2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) <2003> David Schleef <ds@schleef.org>
4 * Copyright (C) <2010> Sebastian Dröge <sebastian.droege@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * This file was (probably) generated from gstvideobalance.c,
24 * gstvideobalance.c,v 1.7 2003/11/08 02:48:59 dschleef Exp
28 * SECTION:element-videobalance
30 * Adjusts brightness, contrast, hue, saturation on a video stream.
33 * <title>Example launch line</title>
35 * gst-launch videotestsrc ! videobalance saturation=0.0 ! ffmpegcolorspace ! ximagesink
36 * ]| This pipeline converts the image to black and white by setting the
40 * Last reviewed on 2010-04-18 (0.10.22)
47 #include <gst/math-compat.h>
49 #include "gstvideobalance.h"
52 #include <gst/controller/gstcontroller.h>
53 #include <gst/interfaces/colorbalance.h>
55 GST_DEBUG_CATEGORY_STATIC (videobalance_debug);
56 #define GST_CAT_DEFAULT videobalance_debug
58 /* GstVideoBalance properties */
59 #define DEFAULT_PROP_CONTRAST 1.0
60 #define DEFAULT_PROP_BRIGHTNESS 0.0
61 #define DEFAULT_PROP_HUE 0.0
62 #define DEFAULT_PROP_SATURATION 1.0
73 static GstStaticPadTemplate gst_video_balance_src_template =
74 GST_STATIC_PAD_TEMPLATE ("src",
77 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
78 "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
79 "xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
80 "I420, YV12, IYUV, Y41B }"))
83 static GstStaticPadTemplate gst_video_balance_sink_template =
84 GST_STATIC_PAD_TEMPLATE ("sink",
87 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
88 "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
89 "xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
90 "I420, YV12, IYUV, Y41B }"))
93 static void gst_video_balance_colorbalance_init (GstColorBalanceInterface *
96 static void gst_video_balance_set_property (GObject * object, guint prop_id,
97 const GValue * value, GParamSpec * pspec);
98 static void gst_video_balance_get_property (GObject * object, guint prop_id,
99 GValue * value, GParamSpec * pspec);
101 #define gst_video_balance_parent_class parent_class
102 G_DEFINE_TYPE_WITH_CODE (GstVideoBalance, gst_video_balance,
103 GST_TYPE_VIDEO_FILTER,
104 G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
105 gst_video_balance_colorbalance_init));
108 * look-up tables (LUT).
111 gst_video_balance_update_tables (GstVideoBalance * vb)
114 gdouble y, u, v, hue_cos, hue_sin;
117 for (i = 0; i < 256; i++) {
118 y = 16 + ((i - 16) * vb->contrast + vb->brightness * 255);
123 vb->tabley[i] = rint (y);
126 hue_cos = cos (G_PI * vb->hue);
127 hue_sin = sin (G_PI * vb->hue);
129 /* U/V lookup tables are 2D, since we need both U/V for each table
131 for (i = -128; i < 128; i++) {
132 for (j = -128; j < 128; j++) {
133 u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation);
134 v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation);
143 vb->tableu[i + 128][j + 128] = rint (u);
144 vb->tablev[i + 128][j + 128] = rint (v);
150 gst_video_balance_is_passthrough (GstVideoBalance * videobalance)
152 return videobalance->contrast == 1.0 &&
153 videobalance->brightness == 0.0 &&
154 videobalance->hue == 0.0 && videobalance->saturation == 1.0;
158 gst_video_balance_update_properties (GstVideoBalance * videobalance)
160 gboolean passthrough = gst_video_balance_is_passthrough (videobalance);
161 GstBaseTransform *base = GST_BASE_TRANSFORM (videobalance);
163 base->passthrough = passthrough;
166 gst_video_balance_update_tables (videobalance);
170 gst_video_balance_planar_yuv (GstVideoBalance * videobalance,
171 GstVideoFrame * frame)
175 guint8 *udata, *vdata;
176 gint ystride, ustride, vstride;
178 gint width2, height2;
179 guint8 *tabley = videobalance->tabley;
180 guint8 **tableu = videobalance->tableu;
181 guint8 **tablev = videobalance->tablev;
183 width = GST_VIDEO_FRAME_WIDTH (frame);
184 height = GST_VIDEO_FRAME_HEIGHT (frame);
186 ydata = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
187 ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
189 for (y = 0; y < height; y++) {
192 yptr = ydata + y * ystride;
193 for (x = 0; x < width; x++) {
194 *yptr = tabley[*yptr];
199 width2 = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1);
200 height2 = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1);
202 udata = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
203 vdata = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
204 ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
205 vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
207 for (y = 0; y < height2; y++) {
211 uptr = udata + y * ustride;
212 vptr = vdata + y * vstride;
214 for (x = 0; x < width2; x++) {
218 *uptr++ = tableu[u1][v1];
219 *vptr++ = tablev[u1][v1];
225 gst_video_balance_packed_yuv (GstVideoBalance * videobalance,
226 GstVideoFrame * frame)
229 guint8 *ydata, *udata, *vdata;
230 gint yoff, uoff, voff;
232 gint width2, height2;
233 guint8 *tabley = videobalance->tabley;
234 guint8 **tableu = videobalance->tableu;
235 guint8 **tablev = videobalance->tablev;
237 width = GST_VIDEO_FRAME_WIDTH (frame);
238 height = GST_VIDEO_FRAME_HEIGHT (frame);
240 stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
241 ydata = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
242 yoff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
244 for (y = 0; y < height; y++) {
247 yptr = ydata + y * stride;
248 for (x = 0; x < width; x++) {
249 *yptr = tabley[*yptr];
254 width2 = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1);
255 height2 = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1);
257 udata = GST_VIDEO_FRAME_COMP_DATA (frame, 1);
258 vdata = GST_VIDEO_FRAME_COMP_DATA (frame, 2);
259 uoff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 1);
260 voff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 2);
262 for (y = 0; y < height2; y++) {
266 uptr = udata + y * stride;
267 vptr = vdata + y * stride;
269 for (x = 0; x < width2; x++) {
273 *uptr = tableu[u1][v1];
274 *vptr = tablev[u1][v1];
282 static const int cog_ycbcr_to_rgb_matrix_8bit_sdtv[] = {
284 298, -100, -208, 34707,
288 static const gint cog_rgb_to_ycbcr_matrix_8bit_sdtv[] = {
290 -38, -74, 112, 32768,
291 112, -94, -18, 32768,
294 #define APPLY_MATRIX(m,o,v1,v2,v3) ((m[o*4] * v1 + m[o*4+1] * v2 + m[o*4+2] * v3 + m[o*4+3]) >> 8)
297 gst_video_balance_packed_rgb (GstVideoBalance * videobalance,
298 GstVideoFrame * frame)
301 gint width, stride, row_wrap;
308 guint8 *tabley = videobalance->tabley;
309 guint8 **tableu = videobalance->tableu;
310 guint8 **tablev = videobalance->tablev;
312 width = GST_VIDEO_FRAME_WIDTH (frame);
313 height = GST_VIDEO_FRAME_HEIGHT (frame);
315 offsets[0] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 0);
316 offsets[1] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 1);
317 offsets[2] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 2);
319 data = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
320 stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
322 pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
323 row_wrap = stride - pixel_stride * width;
325 for (i = 0; i < height; i++) {
326 for (j = 0; j < width; j++) {
327 r = data[offsets[0]];
328 g = data[offsets[1]];
329 b = data[offsets[2]];
331 y = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 0, r, g, b);
332 u_tmp = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 1, r, g, b);
333 v_tmp = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 2, r, g, b);
335 y = CLAMP (y, 0, 255);
336 u_tmp = CLAMP (u_tmp, 0, 255);
337 v_tmp = CLAMP (v_tmp, 0, 255);
340 u = tableu[u_tmp][v_tmp];
341 v = tablev[u_tmp][v_tmp];
343 r = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 0, y, u, v);
344 g = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 1, y, u, v);
345 b = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 2, y, u, v);
347 data[offsets[0]] = CLAMP (r, 0, 255);
348 data[offsets[1]] = CLAMP (g, 0, 255);
349 data[offsets[2]] = CLAMP (b, 0, 255);
350 data += pixel_stride;
356 /* get notified of caps and plug in the correct process function */
358 gst_video_balance_set_caps (GstBaseTransform * base, GstCaps * incaps,
361 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (base);
364 GST_DEBUG_OBJECT (videobalance,
365 "in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
367 videobalance->process = NULL;
369 if (!gst_video_info_from_caps (&info, incaps))
372 switch (GST_VIDEO_INFO_FORMAT (&info)) {
373 case GST_VIDEO_FORMAT_I420:
374 case GST_VIDEO_FORMAT_YV12:
375 case GST_VIDEO_FORMAT_Y41B:
376 case GST_VIDEO_FORMAT_Y42B:
377 case GST_VIDEO_FORMAT_Y444:
378 videobalance->process = gst_video_balance_planar_yuv;
380 case GST_VIDEO_FORMAT_YUY2:
381 case GST_VIDEO_FORMAT_UYVY:
382 case GST_VIDEO_FORMAT_AYUV:
383 case GST_VIDEO_FORMAT_YVYU:
384 videobalance->process = gst_video_balance_packed_yuv;
386 case GST_VIDEO_FORMAT_ARGB:
387 case GST_VIDEO_FORMAT_ABGR:
388 case GST_VIDEO_FORMAT_RGBA:
389 case GST_VIDEO_FORMAT_BGRA:
390 case GST_VIDEO_FORMAT_xRGB:
391 case GST_VIDEO_FORMAT_xBGR:
392 case GST_VIDEO_FORMAT_RGBx:
393 case GST_VIDEO_FORMAT_BGRx:
394 case GST_VIDEO_FORMAT_RGB:
395 case GST_VIDEO_FORMAT_BGR:
396 videobalance->process = gst_video_balance_packed_rgb;
403 videobalance->info = info;
409 GST_ERROR_OBJECT (videobalance, "Invalid caps: %" GST_PTR_FORMAT, incaps);
414 GST_ERROR_OBJECT (videobalance, "unknown format %" GST_PTR_FORMAT, incaps);
420 gst_video_balance_before_transform (GstBaseTransform * base, GstBuffer * buf)
422 GstVideoBalance *balance = GST_VIDEO_BALANCE (base);
423 GstClockTime timestamp, stream_time;
425 timestamp = GST_BUFFER_TIMESTAMP (buf);
427 gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
429 GST_DEBUG_OBJECT (balance, "sync to %" GST_TIME_FORMAT,
430 GST_TIME_ARGS (timestamp));
432 if (GST_CLOCK_TIME_IS_VALID (stream_time))
433 gst_object_sync_values (G_OBJECT (balance), stream_time);
437 gst_video_balance_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
439 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (base);
442 if (!videobalance->process)
445 /* if no change is needed, we are done */
446 if (base->passthrough)
449 if (!gst_video_frame_map (&frame, &videobalance->info, outbuf,
453 GST_OBJECT_LOCK (videobalance);
454 videobalance->process (videobalance, &frame);
455 GST_OBJECT_UNLOCK (videobalance);
457 gst_video_frame_unmap (&frame);
465 GST_ELEMENT_ERROR (videobalance, STREAM, FORMAT,
466 (NULL), ("Invalid buffer received"));
467 return GST_FLOW_ERROR;
471 GST_ERROR_OBJECT (videobalance, "Not negotiated yet");
472 return GST_FLOW_NOT_NEGOTIATED;
477 gst_video_balance_finalize (GObject * object)
479 GList *channels = NULL;
480 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
482 g_free (balance->tableu[0]);
484 channels = balance->channels;
486 GstColorBalanceChannel *channel = channels->data;
488 g_object_unref (channel);
489 channels->data = NULL;
490 channels = g_list_next (channels);
493 if (balance->channels)
494 g_list_free (balance->channels);
496 G_OBJECT_CLASS (parent_class)->finalize (object);
500 gst_video_balance_class_init (GstVideoBalanceClass * klass)
502 GObjectClass *gobject_class = (GObjectClass *) klass;
503 GstElementClass *gstelement_class = (GstElementClass *) klass;
504 GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
506 GST_DEBUG_CATEGORY_INIT (videobalance_debug, "videobalance", 0,
509 gobject_class->finalize = gst_video_balance_finalize;
510 gobject_class->set_property = gst_video_balance_set_property;
511 gobject_class->get_property = gst_video_balance_get_property;
513 g_object_class_install_property (gobject_class, PROP_CONTRAST,
514 g_param_spec_double ("contrast", "Contrast", "contrast",
515 0.0, 2.0, DEFAULT_PROP_CONTRAST,
516 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
517 g_object_class_install_property (gobject_class, PROP_BRIGHTNESS,
518 g_param_spec_double ("brightness", "Brightness", "brightness", -1.0, 1.0,
519 DEFAULT_PROP_BRIGHTNESS,
520 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
521 g_object_class_install_property (gobject_class, PROP_HUE,
522 g_param_spec_double ("hue", "Hue", "hue", -1.0, 1.0, DEFAULT_PROP_HUE,
523 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
524 g_object_class_install_property (gobject_class, PROP_SATURATION,
525 g_param_spec_double ("saturation", "Saturation", "saturation", 0.0, 2.0,
526 DEFAULT_PROP_SATURATION,
527 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
529 gst_element_class_set_details_simple (gstelement_class, "Video balance",
530 "Filter/Effect/Video",
531 "Adjusts brightness, contrast, hue, saturation on a video stream",
532 "David Schleef <ds@schleef.org>");
534 gst_element_class_add_pad_template (gstelement_class,
535 gst_static_pad_template_get (&gst_video_balance_sink_template));
536 gst_element_class_add_pad_template (gstelement_class,
537 gst_static_pad_template_get (&gst_video_balance_src_template));
539 trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_balance_set_caps);
540 trans_class->transform_ip =
541 GST_DEBUG_FUNCPTR (gst_video_balance_transform_ip);
542 trans_class->before_transform =
543 GST_DEBUG_FUNCPTR (gst_video_balance_before_transform);
547 gst_video_balance_init (GstVideoBalance * videobalance)
549 const gchar *channels[4] = { "HUE", "SATURATION",
550 "BRIGHTNESS", "CONTRAST"
554 /* Initialize propertiews */
555 videobalance->contrast = DEFAULT_PROP_CONTRAST;
556 videobalance->brightness = DEFAULT_PROP_BRIGHTNESS;
557 videobalance->hue = DEFAULT_PROP_HUE;
558 videobalance->saturation = DEFAULT_PROP_SATURATION;
560 videobalance->tableu[0] = g_new (guint8, 256 * 256 * 2);
561 for (i = 0; i < 256; i++) {
562 videobalance->tableu[i] =
563 videobalance->tableu[0] + i * 256 * sizeof (guint8);
564 videobalance->tablev[i] =
565 videobalance->tableu[0] + 256 * 256 * sizeof (guint8) +
566 i * 256 * sizeof (guint8);
569 gst_video_balance_update_properties (videobalance);
571 /* Generate the channels list */
572 for (i = 0; i < G_N_ELEMENTS (channels); i++) {
573 GstColorBalanceChannel *channel;
575 channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
576 channel->label = g_strdup (channels[i]);
577 channel->min_value = -1000;
578 channel->max_value = 1000;
580 videobalance->channels = g_list_append (videobalance->channels, channel);
585 gst_video_balance_colorbalance_list_channels (GstColorBalance * balance)
587 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (balance);
589 g_return_val_if_fail (videobalance != NULL, NULL);
590 g_return_val_if_fail (GST_IS_VIDEO_BALANCE (videobalance), NULL);
592 return videobalance->channels;
596 gst_video_balance_colorbalance_set_value (GstColorBalance * balance,
597 GstColorBalanceChannel * channel, gint value)
599 GstVideoBalance *vb = GST_VIDEO_BALANCE (balance);
601 gboolean changed = FALSE;
603 g_return_if_fail (vb != NULL);
604 g_return_if_fail (GST_IS_VIDEO_BALANCE (vb));
605 g_return_if_fail (GST_IS_VIDEO_FILTER (vb));
606 g_return_if_fail (channel->label != NULL);
608 GST_BASE_TRANSFORM_LOCK (vb);
609 GST_OBJECT_LOCK (vb);
610 if (!g_ascii_strcasecmp (channel->label, "HUE")) {
611 new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
612 changed = new_val != vb->hue;
614 } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
615 new_val = (value + 1000.0) * 2.0 / 2000.0;
616 changed = new_val != vb->saturation;
617 vb->saturation = new_val;
618 } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
619 new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
620 changed = new_val != vb->brightness;
621 vb->brightness = new_val;
622 } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
623 new_val = (value + 1000.0) * 2.0 / 2000.0;
624 changed = new_val != vb->contrast;
625 vb->contrast = new_val;
629 gst_video_balance_update_properties (vb);
630 GST_OBJECT_UNLOCK (vb);
631 GST_BASE_TRANSFORM_UNLOCK (vb);
634 gst_color_balance_value_changed (balance, channel,
635 gst_color_balance_get_value (balance, channel));
640 gst_video_balance_colorbalance_get_value (GstColorBalance * balance,
641 GstColorBalanceChannel * channel)
643 GstVideoBalance *vb = GST_VIDEO_BALANCE (balance);
646 g_return_val_if_fail (vb != NULL, 0);
647 g_return_val_if_fail (GST_IS_VIDEO_BALANCE (vb), 0);
648 g_return_val_if_fail (channel->label != NULL, 0);
650 if (!g_ascii_strcasecmp (channel->label, "HUE")) {
651 value = (vb->hue + 1) * 2000.0 / 2.0 - 1000.0;
652 } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
653 value = vb->saturation * 2000.0 / 2.0 - 1000.0;
654 } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
655 value = (vb->brightness + 1) * 2000.0 / 2.0 - 1000.0;
656 } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
657 value = vb->contrast * 2000.0 / 2.0 - 1000.0;
664 gst_video_balance_colorbalance_init (GstColorBalanceInterface * iface)
666 GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_SOFTWARE;
667 iface->list_channels = gst_video_balance_colorbalance_list_channels;
668 iface->set_value = gst_video_balance_colorbalance_set_value;
669 iface->get_value = gst_video_balance_colorbalance_get_value;
672 static GstColorBalanceChannel *
673 gst_video_balance_find_channel (GstVideoBalance * balance, const gchar * label)
677 for (l = balance->channels; l; l = l->next) {
678 GstColorBalanceChannel *channel = l->data;
680 if (g_ascii_strcasecmp (channel->label, label) == 0)
687 gst_video_balance_set_property (GObject * object, guint prop_id,
688 const GValue * value, GParamSpec * pspec)
690 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
692 const gchar *label = NULL;
694 GST_BASE_TRANSFORM_LOCK (balance);
695 GST_OBJECT_LOCK (balance);
698 d = g_value_get_double (value);
699 GST_DEBUG_OBJECT (balance, "Changing contrast from %lf to %lf",
700 balance->contrast, d);
701 if (d != balance->contrast)
703 balance->contrast = d;
705 case PROP_BRIGHTNESS:
706 d = g_value_get_double (value);
707 GST_DEBUG_OBJECT (balance, "Changing brightness from %lf to %lf",
708 balance->brightness, d);
709 if (d != balance->brightness)
710 label = "BRIGHTNESS";
711 balance->brightness = d;
714 d = g_value_get_double (value);
715 GST_DEBUG_OBJECT (balance, "Changing hue from %lf to %lf", balance->hue,
717 if (d != balance->hue)
721 case PROP_SATURATION:
722 d = g_value_get_double (value);
723 GST_DEBUG_OBJECT (balance, "Changing saturation from %lf to %lf",
724 balance->saturation, d);
725 if (d != balance->saturation)
726 label = "SATURATION";
727 balance->saturation = d;
730 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
734 gst_video_balance_update_properties (balance);
735 GST_OBJECT_UNLOCK (balance);
736 GST_BASE_TRANSFORM_UNLOCK (balance);
739 GstColorBalanceChannel *channel =
740 gst_video_balance_find_channel (balance, label);
741 gst_color_balance_value_changed (GST_COLOR_BALANCE (balance), channel,
742 gst_color_balance_get_value (GST_COLOR_BALANCE (balance), channel));
747 gst_video_balance_get_property (GObject * object, guint prop_id, GValue * value,
750 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
754 g_value_set_double (value, balance->contrast);
756 case PROP_BRIGHTNESS:
757 g_value_set_double (value, balance->brightness);
760 g_value_set_double (value, balance->hue);
762 case PROP_SATURATION:
763 g_value_set_double (value, balance->saturation);
766 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);