4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jeongmo Yang <jm80.yang@samsung.com>
8 * This library is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU Lesser General Public License as published by the
10 * Free Software Foundation; either version 2.1 of the License, or (at your option)
13 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
14 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 * License for more details.
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this library; if not, write to the Free Software Foundation, Inc., 51
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "gstcamerasrccolorbalance.h"
31 GST_BOILERPLATE( GstCameraSrcColorBalanceChannel,
32 gst_camerasrc_color_balance_channel,
33 GstColorBalanceChannel,
34 GST_TYPE_COLOR_BALANCE_CHANNEL );
36 #ifndef GST_CAT_DEFAULT
37 GST_DEBUG_CATEGORY_EXTERN(camerasrc_debug);
38 #define GST_CAT_DEFAULT camerasrc_debug
39 #endif /* GST_CAT_DEFAULT */
42 gst_camerasrc_color_balance_channel_base_init( gpointer g_class )
47 gst_camerasrc_color_balance_channel_class_init( GstCameraSrcColorBalanceChannelClass* klass )
52 gst_camerasrc_color_balance_channel_init( GstCameraSrcColorBalanceChannel* camerasrc_color_channel, GstCameraSrcColorBalanceChannelClass* klass )
54 camerasrc_color_channel->id = (guint32) - 1;
57 static G_GNUC_UNUSED gboolean
58 gst_camerasrc_color_balance_contains_channel( GstCameraSrc* camerasrc, GstCameraSrcColorBalanceChannel* camerasrc_color_channel )
62 for( item = camerasrc->colors ; item != NULL ; item = item->next )
64 if (item->data == camerasrc_color_channel)
72 gst_camerasrc_color_balance_list_channels( GstCameraSrc* camerasrc )
74 return camerasrc->colors;
78 gst_camerasrc_color_balance_set_value( GstCameraSrc* camerasrc, GstColorBalanceChannel* color_channel, gint value )
80 int error = CAMERASRC_ERR_UNKNOWN;
82 GstCameraSrcColorBalanceChannel *camerasrc_color_channel = GST_CAMERASRC_COLOR_BALANCE_CHANNEL( color_channel );
84 /* assert that we're opened and that we're using a known item */
85 g_return_if_fail( camerasrc );
86 g_return_if_fail( gst_camerasrc_color_balance_contains_channel( camerasrc, camerasrc_color_channel ) );
88 error = camerasrc_set_control( camerasrc->v4l2_handle, camerasrc_color_channel->id, value );
90 if( error != CAMERASRC_SUCCESS )
92 GST_WARNING("Failed to Set ColorBalance[%s],value[%d]", camerasrc_color_channel->parent.label, value);
97 gst_camerasrc_color_balance_get_value( GstCameraSrc* camerasrc, GstColorBalanceChannel* color_channel )
100 GstCameraSrcColorBalanceChannel *camerasrc_color_channel = GST_CAMERASRC_COLOR_BALANCE_CHANNEL( color_channel );
102 /* assert that we're opened and that we're using a known item */
103 g_return_val_if_fail( camerasrc, FALSE );
104 g_return_val_if_fail( gst_camerasrc_color_balance_contains_channel( camerasrc, camerasrc_color_channel ), FALSE );
106 error = camerasrc_get_control( camerasrc->v4l2_handle, camerasrc_color_channel->id, &value );
108 if( error != CAMERASRC_SUCCESS )
110 GST_WARNING("Failed to Get ColorBalance[%s].", camerasrc_color_channel->parent.label);