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/video/colorbalance.h>
54 GST_DEBUG_CATEGORY_STATIC (videobalance_debug);
55 #define GST_CAT_DEFAULT videobalance_debug
57 /* GstVideoBalance properties */
58 #define DEFAULT_PROP_CONTRAST 1.0
59 #define DEFAULT_PROP_BRIGHTNESS 0.0
60 #define DEFAULT_PROP_HUE 0.0
61 #define DEFAULT_PROP_SATURATION 1.0
72 static GstStaticPadTemplate gst_video_balance_src_template =
73 GST_STATIC_PAD_TEMPLATE ("src",
76 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
77 "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
78 "xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
79 "I420, YV12, IYUV, Y41B }"))
82 static GstStaticPadTemplate gst_video_balance_sink_template =
83 GST_STATIC_PAD_TEMPLATE ("sink",
86 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ AYUV, "
87 "ARGB, BGRA, ABGR, RGBA, Y444, xRGB, RGBx, "
88 "xBGR, BGRx, RGB, BGR, Y42B, YUY2, UYVY, YVYU, "
89 "I420, YV12, IYUV, Y41B }"))
92 static void gst_video_balance_colorbalance_init (GstColorBalanceInterface *
95 static void gst_video_balance_set_property (GObject * object, guint prop_id,
96 const GValue * value, GParamSpec * pspec);
97 static void gst_video_balance_get_property (GObject * object, guint prop_id,
98 GValue * value, GParamSpec * pspec);
100 #define gst_video_balance_parent_class parent_class
101 G_DEFINE_TYPE_WITH_CODE (GstVideoBalance, gst_video_balance,
102 GST_TYPE_VIDEO_FILTER,
103 G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
104 gst_video_balance_colorbalance_init));
107 * look-up tables (LUT).
110 gst_video_balance_update_tables (GstVideoBalance * vb)
113 gdouble y, u, v, hue_cos, hue_sin;
116 for (i = 0; i < 256; i++) {
117 y = 16 + ((i - 16) * vb->contrast + vb->brightness * 255);
122 vb->tabley[i] = rint (y);
125 hue_cos = cos (G_PI * vb->hue);
126 hue_sin = sin (G_PI * vb->hue);
128 /* U/V lookup tables are 2D, since we need both U/V for each table
130 for (i = -128; i < 128; i++) {
131 for (j = -128; j < 128; j++) {
132 u = 128 + ((i * hue_cos + j * hue_sin) * vb->saturation);
133 v = 128 + ((-i * hue_sin + j * hue_cos) * vb->saturation);
142 vb->tableu[i + 128][j + 128] = rint (u);
143 vb->tablev[i + 128][j + 128] = rint (v);
149 gst_video_balance_is_passthrough (GstVideoBalance * videobalance)
151 return videobalance->contrast == 1.0 &&
152 videobalance->brightness == 0.0 &&
153 videobalance->hue == 0.0 && videobalance->saturation == 1.0;
157 gst_video_balance_update_properties (GstVideoBalance * videobalance)
159 gboolean passthrough;
160 GstBaseTransform *base = GST_BASE_TRANSFORM (videobalance);
162 GST_OBJECT_LOCK (videobalance);
163 passthrough = gst_video_balance_is_passthrough (videobalance);
165 gst_video_balance_update_tables (videobalance);
166 GST_OBJECT_UNLOCK (videobalance);
168 gst_base_transform_set_passthrough (base, passthrough);
172 gst_video_balance_planar_yuv (GstVideoBalance * videobalance,
173 GstVideoFrame * frame)
177 guint8 *udata, *vdata;
178 gint ystride, ustride, vstride;
180 gint width2, height2;
181 guint8 *tabley = videobalance->tabley;
182 guint8 **tableu = videobalance->tableu;
183 guint8 **tablev = videobalance->tablev;
185 width = GST_VIDEO_FRAME_WIDTH (frame);
186 height = GST_VIDEO_FRAME_HEIGHT (frame);
188 ydata = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
189 ystride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
191 for (y = 0; y < height; y++) {
194 yptr = ydata + y * ystride;
195 for (x = 0; x < width; x++) {
196 *yptr = tabley[*yptr];
201 width2 = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1);
202 height2 = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1);
204 udata = GST_VIDEO_FRAME_PLANE_DATA (frame, 1);
205 vdata = GST_VIDEO_FRAME_PLANE_DATA (frame, 2);
206 ustride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 1);
207 vstride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 2);
209 for (y = 0; y < height2; y++) {
213 uptr = udata + y * ustride;
214 vptr = vdata + y * vstride;
216 for (x = 0; x < width2; x++) {
220 *uptr++ = tableu[u1][v1];
221 *vptr++ = tablev[u1][v1];
227 gst_video_balance_packed_yuv (GstVideoBalance * videobalance,
228 GstVideoFrame * frame)
231 guint8 *ydata, *udata, *vdata;
232 gint yoff, uoff, voff;
234 gint width2, height2;
235 guint8 *tabley = videobalance->tabley;
236 guint8 **tableu = videobalance->tableu;
237 guint8 **tablev = videobalance->tablev;
239 width = GST_VIDEO_FRAME_WIDTH (frame);
240 height = GST_VIDEO_FRAME_HEIGHT (frame);
242 stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
243 ydata = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
244 yoff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
246 for (y = 0; y < height; y++) {
249 yptr = ydata + y * stride;
250 for (x = 0; x < width; x++) {
251 *yptr = tabley[*yptr];
256 width2 = GST_VIDEO_FRAME_COMP_WIDTH (frame, 1);
257 height2 = GST_VIDEO_FRAME_COMP_HEIGHT (frame, 1);
259 udata = GST_VIDEO_FRAME_COMP_DATA (frame, 1);
260 vdata = GST_VIDEO_FRAME_COMP_DATA (frame, 2);
261 uoff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 1);
262 voff = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 2);
264 for (y = 0; y < height2; y++) {
268 uptr = udata + y * stride;
269 vptr = vdata + y * stride;
271 for (x = 0; x < width2; x++) {
275 *uptr = tableu[u1][v1];
276 *vptr = tablev[u1][v1];
284 static const int cog_ycbcr_to_rgb_matrix_8bit_sdtv[] = {
286 298, -100, -208, 34707,
290 static const gint cog_rgb_to_ycbcr_matrix_8bit_sdtv[] = {
292 -38, -74, 112, 32768,
293 112, -94, -18, 32768,
296 #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)
299 gst_video_balance_packed_rgb (GstVideoBalance * videobalance,
300 GstVideoFrame * frame)
303 gint width, stride, row_wrap;
310 guint8 *tabley = videobalance->tabley;
311 guint8 **tableu = videobalance->tableu;
312 guint8 **tablev = videobalance->tablev;
314 width = GST_VIDEO_FRAME_WIDTH (frame);
315 height = GST_VIDEO_FRAME_HEIGHT (frame);
317 offsets[0] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 0);
318 offsets[1] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 1);
319 offsets[2] = GST_VIDEO_FRAME_COMP_OFFSET (frame, 2);
321 data = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
322 stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
324 pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
325 row_wrap = stride - pixel_stride * width;
327 for (i = 0; i < height; i++) {
328 for (j = 0; j < width; j++) {
329 r = data[offsets[0]];
330 g = data[offsets[1]];
331 b = data[offsets[2]];
333 y = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 0, r, g, b);
334 u_tmp = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 1, r, g, b);
335 v_tmp = APPLY_MATRIX (cog_rgb_to_ycbcr_matrix_8bit_sdtv, 2, r, g, b);
337 y = CLAMP (y, 0, 255);
338 u_tmp = CLAMP (u_tmp, 0, 255);
339 v_tmp = CLAMP (v_tmp, 0, 255);
342 u = tableu[u_tmp][v_tmp];
343 v = tablev[u_tmp][v_tmp];
345 r = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 0, y, u, v);
346 g = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 1, y, u, v);
347 b = APPLY_MATRIX (cog_ycbcr_to_rgb_matrix_8bit_sdtv, 2, y, u, v);
349 data[offsets[0]] = CLAMP (r, 0, 255);
350 data[offsets[1]] = CLAMP (g, 0, 255);
351 data[offsets[2]] = CLAMP (b, 0, 255);
352 data += pixel_stride;
358 /* get notified of caps and plug in the correct process function */
360 gst_video_balance_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
361 GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
363 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (vfilter);
365 GST_DEBUG_OBJECT (videobalance,
366 "in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
368 videobalance->process = NULL;
370 switch (GST_VIDEO_INFO_FORMAT (in_info)) {
371 case GST_VIDEO_FORMAT_I420:
372 case GST_VIDEO_FORMAT_YV12:
373 case GST_VIDEO_FORMAT_Y41B:
374 case GST_VIDEO_FORMAT_Y42B:
375 case GST_VIDEO_FORMAT_Y444:
376 videobalance->process = gst_video_balance_planar_yuv;
378 case GST_VIDEO_FORMAT_YUY2:
379 case GST_VIDEO_FORMAT_UYVY:
380 case GST_VIDEO_FORMAT_AYUV:
381 case GST_VIDEO_FORMAT_YVYU:
382 videobalance->process = gst_video_balance_packed_yuv;
384 case GST_VIDEO_FORMAT_ARGB:
385 case GST_VIDEO_FORMAT_ABGR:
386 case GST_VIDEO_FORMAT_RGBA:
387 case GST_VIDEO_FORMAT_BGRA:
388 case GST_VIDEO_FORMAT_xRGB:
389 case GST_VIDEO_FORMAT_xBGR:
390 case GST_VIDEO_FORMAT_RGBx:
391 case GST_VIDEO_FORMAT_BGRx:
392 case GST_VIDEO_FORMAT_RGB:
393 case GST_VIDEO_FORMAT_BGR:
394 videobalance->process = gst_video_balance_packed_rgb;
406 GST_ERROR_OBJECT (videobalance, "unknown format %" GST_PTR_FORMAT, incaps);
412 gst_video_balance_before_transform (GstBaseTransform * base, GstBuffer * buf)
414 GstVideoBalance *balance = GST_VIDEO_BALANCE (base);
415 GstClockTime timestamp, stream_time;
417 timestamp = GST_BUFFER_TIMESTAMP (buf);
419 gst_segment_to_stream_time (&base->segment, GST_FORMAT_TIME, timestamp);
421 GST_DEBUG_OBJECT (balance, "sync to %" GST_TIME_FORMAT,
422 GST_TIME_ARGS (timestamp));
424 if (GST_CLOCK_TIME_IS_VALID (stream_time))
425 gst_object_sync_values (GST_OBJECT (balance), stream_time);
429 gst_video_balance_transform_frame_ip (GstVideoFilter * vfilter,
430 GstVideoFrame * frame)
432 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (vfilter);
434 if (!videobalance->process)
437 GST_OBJECT_LOCK (videobalance);
438 videobalance->process (videobalance, frame);
439 GST_OBJECT_UNLOCK (videobalance);
446 GST_ERROR_OBJECT (videobalance, "Not negotiated yet");
447 return GST_FLOW_NOT_NEGOTIATED;
452 gst_video_balance_finalize (GObject * object)
454 GList *channels = NULL;
455 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
457 g_free (balance->tableu[0]);
459 channels = balance->channels;
461 GstColorBalanceChannel *channel = channels->data;
463 g_object_unref (channel);
464 channels->data = NULL;
465 channels = g_list_next (channels);
468 if (balance->channels)
469 g_list_free (balance->channels);
471 G_OBJECT_CLASS (parent_class)->finalize (object);
475 gst_video_balance_class_init (GstVideoBalanceClass * klass)
477 GObjectClass *gobject_class = (GObjectClass *) klass;
478 GstElementClass *gstelement_class = (GstElementClass *) klass;
479 GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
480 GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
482 GST_DEBUG_CATEGORY_INIT (videobalance_debug, "videobalance", 0,
485 gobject_class->finalize = gst_video_balance_finalize;
486 gobject_class->set_property = gst_video_balance_set_property;
487 gobject_class->get_property = gst_video_balance_get_property;
489 g_object_class_install_property (gobject_class, PROP_CONTRAST,
490 g_param_spec_double ("contrast", "Contrast", "contrast",
491 0.0, 2.0, DEFAULT_PROP_CONTRAST,
492 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
493 g_object_class_install_property (gobject_class, PROP_BRIGHTNESS,
494 g_param_spec_double ("brightness", "Brightness", "brightness", -1.0, 1.0,
495 DEFAULT_PROP_BRIGHTNESS,
496 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
497 g_object_class_install_property (gobject_class, PROP_HUE,
498 g_param_spec_double ("hue", "Hue", "hue", -1.0, 1.0, DEFAULT_PROP_HUE,
499 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
500 g_object_class_install_property (gobject_class, PROP_SATURATION,
501 g_param_spec_double ("saturation", "Saturation", "saturation", 0.0, 2.0,
502 DEFAULT_PROP_SATURATION,
503 GST_PARAM_CONTROLLABLE | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
505 gst_element_class_set_static_metadata (gstelement_class, "Video balance",
506 "Filter/Effect/Video",
507 "Adjusts brightness, contrast, hue, saturation on a video stream",
508 "David Schleef <ds@schleef.org>");
510 gst_element_class_add_pad_template (gstelement_class,
511 gst_static_pad_template_get (&gst_video_balance_sink_template));
512 gst_element_class_add_pad_template (gstelement_class,
513 gst_static_pad_template_get (&gst_video_balance_src_template));
515 trans_class->before_transform =
516 GST_DEBUG_FUNCPTR (gst_video_balance_before_transform);
517 trans_class->transform_ip_on_passthrough = FALSE;
519 vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_video_balance_set_info);
520 vfilter_class->transform_frame_ip =
521 GST_DEBUG_FUNCPTR (gst_video_balance_transform_frame_ip);
525 gst_video_balance_init (GstVideoBalance * videobalance)
527 const gchar *channels[4] = { "HUE", "SATURATION",
528 "BRIGHTNESS", "CONTRAST"
532 /* Initialize propertiews */
533 videobalance->contrast = DEFAULT_PROP_CONTRAST;
534 videobalance->brightness = DEFAULT_PROP_BRIGHTNESS;
535 videobalance->hue = DEFAULT_PROP_HUE;
536 videobalance->saturation = DEFAULT_PROP_SATURATION;
538 videobalance->tableu[0] = g_new (guint8, 256 * 256 * 2);
539 for (i = 0; i < 256; i++) {
540 videobalance->tableu[i] =
541 videobalance->tableu[0] + i * 256 * sizeof (guint8);
542 videobalance->tablev[i] =
543 videobalance->tableu[0] + 256 * 256 * sizeof (guint8) +
544 i * 256 * sizeof (guint8);
547 gst_video_balance_update_properties (videobalance);
549 /* Generate the channels list */
550 for (i = 0; i < G_N_ELEMENTS (channels); i++) {
551 GstColorBalanceChannel *channel;
553 channel = g_object_new (GST_TYPE_COLOR_BALANCE_CHANNEL, NULL);
554 channel->label = g_strdup (channels[i]);
555 channel->min_value = -1000;
556 channel->max_value = 1000;
558 videobalance->channels = g_list_append (videobalance->channels, channel);
563 gst_video_balance_colorbalance_list_channels (GstColorBalance * balance)
565 GstVideoBalance *videobalance = GST_VIDEO_BALANCE (balance);
567 g_return_val_if_fail (videobalance != NULL, NULL);
568 g_return_val_if_fail (GST_IS_VIDEO_BALANCE (videobalance), NULL);
570 return videobalance->channels;
574 gst_video_balance_colorbalance_set_value (GstColorBalance * balance,
575 GstColorBalanceChannel * channel, gint value)
577 GstVideoBalance *vb = GST_VIDEO_BALANCE (balance);
579 gboolean changed = FALSE;
581 g_return_if_fail (vb != NULL);
582 g_return_if_fail (GST_IS_VIDEO_BALANCE (vb));
583 g_return_if_fail (GST_IS_VIDEO_FILTER (vb));
584 g_return_if_fail (channel->label != NULL);
586 GST_OBJECT_LOCK (vb);
587 if (!g_ascii_strcasecmp (channel->label, "HUE")) {
588 new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
589 changed = new_val != vb->hue;
591 } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
592 new_val = (value + 1000.0) * 2.0 / 2000.0;
593 changed = new_val != vb->saturation;
594 vb->saturation = new_val;
595 } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
596 new_val = (value + 1000.0) * 2.0 / 2000.0 - 1.0;
597 changed = new_val != vb->brightness;
598 vb->brightness = new_val;
599 } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
600 new_val = (value + 1000.0) * 2.0 / 2000.0;
601 changed = new_val != vb->contrast;
602 vb->contrast = new_val;
606 gst_video_balance_update_properties (vb);
607 GST_OBJECT_UNLOCK (vb);
610 gst_color_balance_value_changed (balance, channel,
611 gst_color_balance_get_value (balance, channel));
616 gst_video_balance_colorbalance_get_value (GstColorBalance * balance,
617 GstColorBalanceChannel * channel)
619 GstVideoBalance *vb = GST_VIDEO_BALANCE (balance);
622 g_return_val_if_fail (vb != NULL, 0);
623 g_return_val_if_fail (GST_IS_VIDEO_BALANCE (vb), 0);
624 g_return_val_if_fail (channel->label != NULL, 0);
626 if (!g_ascii_strcasecmp (channel->label, "HUE")) {
627 value = (vb->hue + 1) * 2000.0 / 2.0 - 1000.0;
628 } else if (!g_ascii_strcasecmp (channel->label, "SATURATION")) {
629 value = vb->saturation * 2000.0 / 2.0 - 1000.0;
630 } else if (!g_ascii_strcasecmp (channel->label, "BRIGHTNESS")) {
631 value = (vb->brightness + 1) * 2000.0 / 2.0 - 1000.0;
632 } else if (!g_ascii_strcasecmp (channel->label, "CONTRAST")) {
633 value = vb->contrast * 2000.0 / 2.0 - 1000.0;
639 static GstColorBalanceType
640 gst_video_balance_colorbalance_get_balance_type (GstColorBalance * balance)
642 return GST_COLOR_BALANCE_SOFTWARE;
646 gst_video_balance_colorbalance_init (GstColorBalanceInterface * iface)
648 iface->list_channels = gst_video_balance_colorbalance_list_channels;
649 iface->set_value = gst_video_balance_colorbalance_set_value;
650 iface->get_value = gst_video_balance_colorbalance_get_value;
651 iface->get_balance_type = gst_video_balance_colorbalance_get_balance_type;
654 static GstColorBalanceChannel *
655 gst_video_balance_find_channel (GstVideoBalance * balance, const gchar * label)
659 for (l = balance->channels; l; l = l->next) {
660 GstColorBalanceChannel *channel = l->data;
662 if (g_ascii_strcasecmp (channel->label, label) == 0)
669 gst_video_balance_set_property (GObject * object, guint prop_id,
670 const GValue * value, GParamSpec * pspec)
672 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
674 const gchar *label = NULL;
676 GST_OBJECT_LOCK (balance);
679 d = g_value_get_double (value);
680 GST_DEBUG_OBJECT (balance, "Changing contrast from %lf to %lf",
681 balance->contrast, d);
682 if (d != balance->contrast)
684 balance->contrast = d;
686 case PROP_BRIGHTNESS:
687 d = g_value_get_double (value);
688 GST_DEBUG_OBJECT (balance, "Changing brightness from %lf to %lf",
689 balance->brightness, d);
690 if (d != balance->brightness)
691 label = "BRIGHTNESS";
692 balance->brightness = d;
695 d = g_value_get_double (value);
696 GST_DEBUG_OBJECT (balance, "Changing hue from %lf to %lf", balance->hue,
698 if (d != balance->hue)
702 case PROP_SATURATION:
703 d = g_value_get_double (value);
704 GST_DEBUG_OBJECT (balance, "Changing saturation from %lf to %lf",
705 balance->saturation, d);
706 if (d != balance->saturation)
707 label = "SATURATION";
708 balance->saturation = d;
711 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
715 GST_OBJECT_UNLOCK (balance);
716 gst_video_balance_update_properties (balance);
719 GstColorBalanceChannel *channel =
720 gst_video_balance_find_channel (balance, label);
721 gst_color_balance_value_changed (GST_COLOR_BALANCE (balance), channel,
722 gst_color_balance_get_value (GST_COLOR_BALANCE (balance), channel));
727 gst_video_balance_get_property (GObject * object, guint prop_id, GValue * value,
730 GstVideoBalance *balance = GST_VIDEO_BALANCE (object);
734 g_value_set_double (value, balance->contrast);
736 case PROP_BRIGHTNESS:
737 g_value_set_double (value, balance->brightness);
740 g_value_set_double (value, balance->hue);
742 case PROP_SATURATION:
743 g_value_set_double (value, balance->saturation);
746 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);