Initial release
[adaptation/ap_samsung/gst-plugins-s5pc2xx.git] / camerasrc / src / include / gstcamerasrccontrol.h
1 /*
2  * camerasrc
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jeongmo Yang <jm80.yang@samsung.com>
7  *
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)
11  * any later version.
12  *
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.
17  *
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
21  *
22  */
23
24 #ifndef __GST_CAMERASRC_CONTROL_H__
25 #define __GST_CAMERASRC_CONTROL_H__
26
27 #include <gst/gst.h>
28 #include <gst/interfaces/cameracontrol.h>
29 #include "gstcamerasrc.h"
30
31 G_BEGIN_DECLS
32
33 #define GST_TYPE_CAMERASRC_CONTROL_CHANNEL (gst_camerasrc_control_channel_get_type ())
34 #define GST_CAMERASRC_CONTROL_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERASRC_CONTROL_CHANNEL, GstCamerasrcControlChannel))
35 #define GST_CAMERASRC_CONTROL_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CAMERASRC_CONTROL_CHANNEL, GstCamerasrcControlChannelClass))
36 #define GST_IS_CAMERASRC_CONTROL_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERASRC_CONTROL_CHANNEL))
37 #define GST_IS_CAMERASRC_CONTROL_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CAMERASRC_CONTROL_CHANNEL))
38
39 typedef struct _GstCamerasrcControlChannel {
40 GstCameraControlChannel parent;
41 guint32 id;
42 } GstCamerasrcControlChannel;
43
44 typedef struct _GstCamerasrcControlChannelClass {
45 GstCameraControlChannelClass parent;
46 } GstCamerasrcControlChannelClass;
47
48 GType gst_camerasrc_control_channel_get_type( void );
49
50 const GList*gst_camerasrc_control_list_channels( GstCameraSrc* camera_src );
51
52 gboolean    gst_camerasrc_control_set_value          ( GstCameraSrc* camera_src, GstCameraControlChannel* control_channel, gint value );
53 gboolean    gst_camerasrc_control_get_value          ( GstCameraSrc* camera_src, GstCameraControlChannel* control_channel, gint* value );
54 gboolean    gst_camerasrc_control_set_exposure       ( GstCameraSrc* camera_src, gint type, gint value1, gint value2 );
55 gboolean    gst_camerasrc_control_get_exposure       ( GstCameraSrc* camera_src, gint type, gint* value1, gint* value2 );
56 gboolean    gst_camerasrc_control_set_capture_mode   ( GstCameraSrc* camera_src, gint type, gint value );
57 gboolean    gst_camerasrc_control_get_capture_mode   ( GstCameraSrc* camera_src, gint type, gint* value );
58 gboolean    gst_camerasrc_control_set_strobe         ( GstCameraSrc* camera_src, gint type, gint value );
59 gboolean    gst_camerasrc_control_get_strobe         ( GstCameraSrc* camera_src, gint type, gint *value );
60 gboolean    gst_camerasrc_control_set_detect         ( GstCameraSrc* camera_src, gint type, gint value );
61 gboolean    gst_camerasrc_control_get_detect         ( GstCameraSrc* camera_src, gint type, gint* value );
62 gboolean    gst_camerasrc_control_set_zoom           ( GstCameraSrc* camera_src, gint type, gint value );
63 gboolean    gst_camerasrc_control_get_zoom           ( GstCameraSrc* camera_src, gint type, gint* value );
64 gboolean    gst_camerasrc_control_set_focus          ( GstCameraSrc* camera_src, gint mode, gint range );
65 gboolean    gst_camerasrc_control_get_focus          ( GstCameraSrc* camera_src, gint* mode, gint* range );
66 gboolean    gst_camerasrc_control_start_auto_focus   ( GstCameraSrc* camera_src );
67 gboolean    gst_camerasrc_control_stop_auto_focus    ( GstCameraSrc* camera_src );
68 gboolean    gst_camerasrc_control_set_focus_level    ( GstCameraSrc* camera_src, gint manual_level );
69 gboolean    gst_camerasrc_control_get_focus_level    ( GstCameraSrc* camera_src, gint* manual_level );
70 gboolean    gst_camerasrc_control_set_auto_focus_area( GstCameraSrc* camera_src, GstCameraControlRectType rect );
71 gboolean    gst_camerasrc_control_get_auto_focus_area( GstCameraSrc* camera_src, GstCameraControlRectType* rect );
72 gboolean    gst_camerasrc_control_set_wdr            ( GstCameraSrc* camera_src, gint value );
73 gboolean    gst_camerasrc_control_get_wdr            ( GstCameraSrc* camera_src, gint* value );
74 gboolean    gst_camerasrc_control_set_ahs            ( GstCameraSrc* camera_src, gint value );
75 gboolean    gst_camerasrc_control_get_ahs            ( GstCameraSrc* camera_src, gint* value );
76 gboolean    gst_camerasrc_control_set_part_color     ( GstCameraSrc* camera_src, gint type, gint value );
77 gboolean    gst_camerasrc_control_get_part_color     ( GstCameraSrc* camera_src, gint type, gint* value );
78 gboolean    gst_camerasrc_control_get_exif_info      ( GstCameraSrc* camera_src, GstCameraControlExifInfo* info );
79 gboolean    gst_camerasrc_control_get_basic_dev_info ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlCapsInfoType* info );
80 gboolean    gst_camerasrc_control_get_misc_dev_info  ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlCtrlListInfoType* info );
81 gboolean    gst_camerasrc_control_get_extra_dev_info ( GstCameraSrc* camera_src, gint dev_id, GstCameraControlExtraInfoType* info );
82 void        gst_camerasrc_control_set_capture_command( GstCameraSrc* camera_src, GstCameraControlCaptureCommand cmd );
83
84 #define GST_IMPLEMENT_CAMERASRC_CONTROL_METHODS(Type, interface_as_function) \
85  \
86 static const GList* \
87 interface_as_function ## _control_list_channels( GstCameraControl* control ) \
88 { \
89         Type* this = (Type*) control; \
90         return gst_camerasrc_control_list_channels( this ); \
91 } \
92  \
93 static gboolean \
94 interface_as_function ## _control_set_value( GstCameraControl* control, \
95                                              GstCameraControlChannel* control_channel, gint value ) \
96 { \
97         Type* this = (Type*)control; \
98         return gst_camerasrc_control_set_value( this, control_channel, value ); \
99 } \
100  \
101 static gboolean \
102 interface_as_function ## _control_get_value( GstCameraControl* control, \
103                                              GstCameraControlChannel* control_channel, gint* value ) \
104 { \
105         Type* this = (Type*)control; \
106         return gst_camerasrc_control_get_value( this, control_channel, value ); \
107 } \
108  \
109 static gboolean \
110 interface_as_function ## _control_set_exposure( GstCameraControl* control, \
111                                                 gint type, gint value1, gint value2 ) \
112 { \
113         Type* this = (Type*)control; \
114         return gst_camerasrc_control_set_exposure( this, type, value1, value2 ); \
115 } \
116  \
117 static gboolean \
118 interface_as_function ## _control_get_exposure( GstCameraControl* control, \
119                                                 gint type, gint* value1, gint* value2 ) \
120 { \
121         Type* this = (Type*)control; \
122         return gst_camerasrc_control_get_exposure( this, type, value1, value2 ); \
123 } \
124  \
125 static gboolean \
126 interface_as_function ## _control_set_capture_mode( GstCameraControl* control, \
127                                                     gint type, gint value ) \
128 { \
129         Type* this = (Type*)control; \
130         return gst_camerasrc_control_set_capture_mode( this, type, value ); \
131 } \
132  \
133 static gboolean \
134 interface_as_function ## _control_get_capture_mode( GstCameraControl* control, \
135                                                     gint type, gint* value ) \
136 { \
137         Type* this = (Type*)control; \
138         return gst_camerasrc_control_get_capture_mode( this, type, value ); \
139 } \
140  \
141 static gboolean \
142 interface_as_function ## _control_set_strobe( GstCameraControl* control, \
143                                               gint type, gint value ) \
144 { \
145         Type* this = (Type*)control; \
146         return gst_camerasrc_control_set_strobe( this, type, value ); \
147 } \
148  \
149 static gboolean \
150 interface_as_function ## _control_get_strobe( GstCameraControl* control, \
151                                               gint type, gint* value ) \
152 { \
153         Type* this = (Type*)control; \
154         return gst_camerasrc_control_get_strobe( this, type, value ); \
155 } \
156  \
157 static gboolean \
158 interface_as_function ## _control_set_detect( GstCameraControl* control, \
159                                               gint type, gint value ) \
160 { \
161         Type* this = (Type*)control; \
162         return gst_camerasrc_control_set_detect( this, type, value ); \
163 } \
164  \
165 static gboolean \
166 interface_as_function ## _control_get_detect( GstCameraControl* control, \
167                                               gint type, gint* value ) \
168 { \
169         Type* this = (Type*)control; \
170         return gst_camerasrc_control_get_detect( this, type, value ); \
171 } \
172  \
173 static gboolean \
174 interface_as_function ## _control_set_zoom( GstCameraControl* control, \
175                                             gint type, gint value ) \
176 { \
177         Type* this = (Type*)control; \
178         return gst_camerasrc_control_set_zoom( this, type, value ); \
179 } \
180  \
181 static gboolean \
182 interface_as_function ## _control_get_zoom( GstCameraControl* control, \
183                                             gint type, gint* value ) \
184 { \
185         Type* this = (Type*)control; \
186         return gst_camerasrc_control_get_zoom( this, type, value ); \
187 } \
188  \
189 static gboolean \
190 interface_as_function ## _control_set_focus( GstCameraControl* control, \
191                                              gint focus_mode, gint focus_range ) \
192 { \
193         Type* this = (Type*)control; \
194         return gst_camerasrc_control_set_focus( this, focus_mode, focus_range ); \
195 } \
196  \
197 static gboolean \
198 interface_as_function ## _control_get_focus( GstCameraControl* control, \
199                                              gint* focus_mode, gint* focus_range ) \
200 { \
201         Type* this = (Type*)control; \
202         return gst_camerasrc_control_get_focus( this, focus_mode, focus_range ); \
203 } \
204  \
205 static gboolean \
206 interface_as_function ## _control_start_auto_focus( GstCameraControl* control) \
207 { \
208         Type* this = (Type*)control; \
209         return gst_camerasrc_control_start_auto_focus( this ); \
210 } \
211  \
212 static gboolean \
213 interface_as_function ## _control_stop_auto_focus( GstCameraControl* control) \
214 { \
215         Type* this = (Type*)control; \
216         return gst_camerasrc_control_stop_auto_focus( this ); \
217 } \
218  \
219 static gboolean \
220 interface_as_function ## _control_set_focus_level( GstCameraControl* control, \
221                                                    gint focus_level ) \
222 { \
223         Type* this = (Type*)control; \
224         return gst_camerasrc_control_set_focus_level( this, focus_level ); \
225 } \
226  \
227 static gboolean \
228 interface_as_function ## _control_get_focus_level( GstCameraControl* control, \
229                                                    gint* focus_level ) \
230 { \
231         Type* this = (Type*)control; \
232         return gst_camerasrc_control_get_focus_level( this, focus_level ); \
233 } \
234  \
235 static gboolean \
236 interface_as_function ## _control_set_auto_focus_area( GstCameraControl* control, \
237                                                        GstCameraControlRectType rect ) \
238 { \
239         Type* this = (Type*)control; \
240         return gst_camerasrc_control_set_auto_focus_area( this, rect ); \
241 } \
242  \
243 static gboolean \
244 interface_as_function ## _control_get_auto_focus_area( GstCameraControl* control, \
245                                                        GstCameraControlRectType* rect ) \
246 { \
247         Type* this = (Type*)control; \
248         return gst_camerasrc_control_get_auto_focus_area( this, rect ); \
249 } \
250  \
251 static gboolean \
252 interface_as_function ## _control_set_wdr( GstCameraControl* control, \
253                                            gint value ) \
254 { \
255         Type* this = (Type*)control; \
256         return gst_camerasrc_control_set_wdr( this, value ); \
257 } \
258  \
259 static gboolean \
260 interface_as_function ## _control_get_wdr( GstCameraControl* control, \
261                                            gint* value ) \
262 { \
263         Type* this = (Type*)control; \
264         return gst_camerasrc_control_get_wdr( this, value ); \
265 } \
266  \
267 static gboolean \
268 interface_as_function ## _control_set_ahs( GstCameraControl* control, \
269                                            gint value ) \
270 { \
271         Type* this = (Type*)control; \
272         return gst_camerasrc_control_set_ahs( this, value ); \
273 } \
274  \
275 static gboolean \
276 interface_as_function ## _control_get_ahs( GstCameraControl* control, \
277                                            gint* value ) \
278 { \
279         Type* this = (Type*)control; \
280         return gst_camerasrc_control_get_ahs( this, value ); \
281 } \
282  \
283 static gboolean \
284 interface_as_function ## _control_set_part_color( GstCameraControl* control, \
285                                                   gint type, gint value ) \
286 { \
287         Type* this = (Type*)control; \
288         return gst_camerasrc_control_set_part_color( this, type, value ); \
289 } \
290  \
291 static gboolean \
292 interface_as_function ## _control_get_part_color( GstCameraControl* control, \
293                                                   gint type, gint* value ) \
294 { \
295         Type* this = (Type*)control; \
296         return gst_camerasrc_control_get_part_color( this, type, value ); \
297 } \
298  \
299 static gboolean \
300 interface_as_function ## _control_get_exif_info( GstCameraControl* control, \
301                                                  GstCameraControlExifInfo* info ) \
302 { \
303         Type* this = (Type*)control; \
304         return gst_camerasrc_control_get_exif_info( this, info); \
305 } \
306  \
307 static gboolean \
308 interface_as_function ## _control_get_basic_dev_info( GstCameraControl* control, \
309                                                       gint dev_id, \
310                                                       GstCameraControlCapsInfoType* info ) \
311 { \
312         Type* this = (Type*)control; \
313         return gst_camerasrc_control_get_basic_dev_info( this, dev_id, info); \
314 } \
315  \
316 static gboolean \
317 interface_as_function ## _control_get_misc_dev_info( GstCameraControl* control, \
318                                                      gint dev_id, \
319                                                      GstCameraControlCtrlListInfoType* info ) \
320 { \
321         Type* this = (Type*)control; \
322         return gst_camerasrc_control_get_misc_dev_info( this, dev_id, info); \
323 } \
324  \
325 static gboolean \
326 interface_as_function ## _control_get_extra_dev_info( GstCameraControl* control, \
327                                                       gint dev_id, \
328                                                       GstCameraControlExtraInfoType* info ) \
329 { \
330         Type* this = (Type*)control; \
331         return gst_camerasrc_control_get_extra_dev_info( this, dev_id, info); \
332 } \
333  \
334 static void \
335 interface_as_function ## _control_set_capture_command( GstCameraControl* control, \
336                                                        GstCameraControlCaptureCommand cmd ) \
337 { \
338         Type* this = (Type*)control; \
339         gst_camerasrc_control_set_capture_command( this, cmd ); \
340         return; \
341 } \
342  \
343 void \
344 interface_as_function ## _control_interface_init( GstCameraControlClass *klass ) \
345 { \
346         GST_CAMERA_CONTROL_TYPE( klass ) = GST_CAMERA_CONTROL_HARDWARE; \
347  \
348         /* default virtual functions */ \
349         klass->list_channels = interface_as_function ## _control_list_channels; \
350         klass->set_value = interface_as_function ## _control_set_value; \
351         klass->get_value = interface_as_function ## _control_get_value; \
352         klass->set_exposure = interface_as_function ## _control_set_exposure; \
353         klass->get_exposure = interface_as_function ## _control_get_exposure; \
354         klass->set_capture_mode = interface_as_function ## _control_set_capture_mode; \
355         klass->get_capture_mode = interface_as_function ## _control_get_capture_mode; \
356         klass->set_strobe = interface_as_function ## _control_set_strobe; \
357         klass->get_strobe = interface_as_function ## _control_get_strobe; \
358         klass->set_detect = interface_as_function ## _control_set_detect; \
359         klass->get_detect = interface_as_function ## _control_get_detect; \
360         klass->set_zoom = interface_as_function ## _control_set_zoom; \
361         klass->get_zoom = interface_as_function ## _control_get_zoom; \
362         klass->set_focus = interface_as_function ## _control_set_focus; \
363         klass->get_focus = interface_as_function ## _control_get_focus; \
364         klass->start_auto_focus = interface_as_function ## _control_start_auto_focus; \
365         klass->stop_auto_focus = interface_as_function ## _control_stop_auto_focus; \
366         klass->set_focus_level = interface_as_function ## _control_set_focus_level; \
367         klass->get_focus_level = interface_as_function ## _control_get_focus_level; \
368         klass->set_auto_focus_area = interface_as_function ## _control_set_auto_focus_area; \
369         klass->get_auto_focus_area = interface_as_function ## _control_get_auto_focus_area; \
370         klass->set_wdr = interface_as_function ## _control_set_wdr; \
371         klass->get_wdr = interface_as_function ## _control_get_wdr; \
372         klass->set_ahs = interface_as_function ## _control_set_ahs; \
373         klass->get_ahs = interface_as_function ## _control_get_ahs; \
374         klass->set_part_color = interface_as_function ## _control_set_part_color; \
375         klass->get_part_color = interface_as_function ## _control_get_part_color; \
376         klass->get_exif_info = interface_as_function ## _control_get_exif_info; \
377         klass->get_basic_dev_info = interface_as_function ## _control_get_basic_dev_info; \
378         klass->get_misc_dev_info = interface_as_function ## _control_get_misc_dev_info; \
379         klass->get_extra_dev_info = interface_as_function ## _control_get_extra_dev_info; \
380         klass->set_capture_command = interface_as_function ## _control_set_capture_command; \
381  \
382 }
383
384 #endif /* __GST_CAMERASRC_CONTROL_H__ */