Fix FSF address
[platform/upstream/gst-plugins-good.git] / sys / v4l2 / gstv4l2colorbalance.h
1 /* GStreamer
2  *
3  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
4  *               2006 Edgard Lima <edgard.lima@indt.org.br>
5  *
6  * gstv4l2colorbalance.h: color balance interface implementation for V4L2
7  *
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.
12  *
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.
17  *
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.
22  */
23
24 #ifndef __GST_V4L2_COLOR_BALANCE_H__
25 #define __GST_V4L2_COLOR_BALANCE_H__
26
27 #include <gst/gst.h>
28 #include <gst/video/colorbalance.h>
29 #include "v4l2_calls.h"
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL \
34   (gst_v4l2_color_balance_channel_get_type ())
35 #define GST_V4L2_COLOR_BALANCE_CHANNEL(obj) \
36   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL, \
37                                GstV4l2ColorBalanceChannel))
38 #define GST_V4L2_COLOR_BALANCE_CHANNEL_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL, \
40                             GstV4l2ColorBalanceChannelClass))
41 #define GST_IS_V4L2_COLOR_BALANCE_CHANNEL(obj) \
42   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL))
43 #define GST_IS_V4L2_COLOR_BALANCE_CHANNEL_CLASS(klass) \
44   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_V4L2_COLOR_BALANCE_CHANNEL))
45
46 typedef struct _GstV4l2ColorBalanceChannel {
47   GstColorBalanceChannel parent;
48
49   guint32 id;
50 } GstV4l2ColorBalanceChannel;
51
52 typedef struct _GstV4l2ColorBalanceChannelClass {
53   GstColorBalanceChannelClass parent;
54 } GstV4l2ColorBalanceChannelClass;
55
56 GType gst_v4l2_color_balance_channel_get_type   (void);
57
58 const GList *   gst_v4l2_color_balance_list_channels    (GstV4l2Object * v4l2object);
59
60 void            gst_v4l2_color_balance_set_value        (GstV4l2Object * v4l2object,
61                                                          GstColorBalanceChannel * channel,
62                                                          gint value);
63
64 gint            gst_v4l2_color_balance_get_value        (GstV4l2Object * v4l2object,
65                                                          GstColorBalanceChannel * channel);
66
67 #define GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS(Type, interface_as_function)         \
68                                                                                       \
69 static const GList *                                                                  \
70 interface_as_function ## _color_balance_list_channels (GstColorBalance * balance)     \
71 {                                                                                     \
72   Type *this = (Type*) balance;                                                       \
73   return gst_v4l2_color_balance_list_channels(this->v4l2object);                      \
74 }                                                                                     \
75                                                                                       \
76 static void                                                                           \
77 interface_as_function ## _color_balance_set_value (GstColorBalance * balance,         \
78                                                    GstColorBalanceChannel * channel,  \
79                                                    gint value)                        \
80 {                                                                                     \
81   Type *this = (Type*) balance;                                                       \
82   gst_v4l2_color_balance_set_value(this->v4l2object, channel, value);          \
83 }                                                                                     \
84                                                                                       \
85 static gint                                                                           \
86 interface_as_function ## _color_balance_get_value (GstColorBalance * balance,         \
87                                                    GstColorBalanceChannel * channel)  \
88 {                                                                                     \
89   Type *this = (Type*) balance;                                                       \
90   return gst_v4l2_color_balance_get_value(this->v4l2object, channel);                 \
91 }                                                                                     \
92                                                                                       \
93 static GstColorBalanceType                                                            \
94 interface_as_function ## _color_balance_get_balance_type (GstColorBalance * balance)  \
95 {                                                                                     \
96   return GST_COLOR_BALANCE_HARDWARE;                                                  \
97 }                                                                                     \
98                                                                                       \
99 static void                                                                           \
100 interface_as_function ## _color_balance_interface_init (GstColorBalanceInterface * iface) \
101 {                                                                                     \
102   /* default virtual functions */                                                     \
103   iface->list_channels = interface_as_function ## _color_balance_list_channels;       \
104   iface->set_value = interface_as_function ## _color_balance_set_value;               \
105   iface->get_value = interface_as_function ## _color_balance_get_value;               \
106   iface->get_balance_type = interface_as_function ## _color_balance_get_balance_type; \
107 }                                                                                     \
108
109 G_END_DECLS
110 #endif /* __GST_V4L2_COLOR_BALANCE_H__ */