3 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * 2006 Edgard Lima <edgard.lima@gmail.com>
6 * gstv4l2colorbalance.c: color balance interface implementation for V4L2
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
29 #include "gstv4l2colorbalance.h"
30 #include "gstv4l2object.h"
32 #define gst_v4l2_color_balance_channel_parent_class parent_class
33 G_DEFINE_TYPE (GstV4l2ColorBalanceChannel,
34 gst_v4l2_color_balance_channel, GST_TYPE_COLOR_BALANCE_CHANNEL);
37 gst_v4l2_color_balance_channel_class_init (GstV4l2ColorBalanceChannelClass *
43 gst_v4l2_color_balance_channel_init (GstV4l2ColorBalanceChannel * channel)
45 channel->id = (guint32) - 1;
48 static G_GNUC_UNUSED gboolean
49 gst_v4l2_color_balance_contains_channel (GstV4l2Object * v4l2object,
50 GstV4l2ColorBalanceChannel * v4l2channel)
54 for (item = v4l2object->colors; item != NULL; item = item->next)
55 if (item->data == v4l2channel)
62 gst_v4l2_color_balance_list_channels (GstV4l2Object * v4l2object)
64 return v4l2object->colors;
68 gst_v4l2_color_balance_set_value (GstV4l2Object * v4l2object,
69 GstColorBalanceChannel * channel, gint value)
72 GstV4l2ColorBalanceChannel *v4l2channel =
73 GST_V4L2_COLOR_BALANCE_CHANNEL (channel);
75 /* assert that we're opened and that we're using a known item */
76 g_return_if_fail (GST_V4L2_IS_OPEN (v4l2object));
77 g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2object,
80 gst_v4l2_set_attribute (v4l2object, v4l2channel->id, value);
84 gst_v4l2_color_balance_get_value (GstV4l2Object * v4l2object,
85 GstColorBalanceChannel * channel)
87 GstV4l2ColorBalanceChannel *v4l2channel =
88 GST_V4L2_COLOR_BALANCE_CHANNEL (channel);
91 /* assert that we're opened and that we're using a known item */
92 g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), 0);
93 g_return_val_if_fail (gst_v4l2_color_balance_contains_channel (v4l2object,
96 if (!gst_v4l2_get_attribute (v4l2object, v4l2channel->id, &value))