2 * GStreamer Camera Control
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
24 /* ===========================================================================================
25 EDIT HISTORY FOR MODULE
27 This section contains comments describing changes made to the module.
28 Notice that changes are listed in reverse chronological order.
30 when who what, where, why
31 --------- ------------------------ ------------------------------------------------------
32 12/09/08 jm80.yang@samsung.com Created
34 =========================================================================================== */
41 #include "cameracontrol.h"
42 #include "interfaces-marshal.h"
45 * SECTION:gstcameracontrol
46 * @short_description: Interface for camera control
51 CONTROL_VALUE_CHANGED,
55 static void gst_camera_control_class_init( GstCameraControlClass *klass );
57 static guint gst_camera_control_signals[CONTROL_LAST_SIGNAL] = { 0 };
60 gst_camera_control_get_type( void )
62 static GType gst_camera_control_type = 0;
64 if( !gst_camera_control_type )
66 static const GTypeInfo gst_camera_control_info =
68 sizeof( GstCameraControlClass ),
69 (GBaseInitFunc) gst_camera_control_class_init,
79 gst_camera_control_type = g_type_register_static( G_TYPE_INTERFACE, "GstCameraControl", &gst_camera_control_info, 0 );
80 g_type_interface_add_prerequisite( gst_camera_control_type, GST_TYPE_IMPLEMENTS_INTERFACE );
83 return gst_camera_control_type;
87 gst_camera_control_class_init( GstCameraControlClass *klass )
89 static gboolean initialized = FALSE;
93 gst_camera_control_signals[CONTROL_VALUE_CHANGED] =
94 g_signal_new ( "control-value-changed",
95 GST_TYPE_CAMERA_CONTROL, G_SIGNAL_RUN_LAST,
96 G_STRUCT_OFFSET( GstCameraControlClass, value_changed ),
98 gst_interfaces_marshal_VOID__OBJECT_INT,
99 G_TYPE_NONE, 2, GST_TYPE_CAMERA_CONTROL_CHANNEL, G_TYPE_INT);
105 klass->camera_control_type = 0;
107 /* defauld virtual functions */
108 klass->list_channels = NULL;
109 klass->set_exposure = NULL;
110 klass->get_exposure = NULL;
111 klass->set_capture_mode = NULL;
112 klass->get_capture_mode = NULL;
113 klass->set_strobe = NULL;
114 klass->get_strobe = NULL;
115 klass->set_detect = NULL;
116 klass->get_detect = NULL;
117 klass->set_value = NULL;
118 klass->get_value = NULL;
119 klass->set_zoom = NULL;
120 klass->get_zoom = NULL;
121 klass->set_focus = NULL;
122 klass->get_focus = NULL;
123 klass->start_auto_focus = NULL;
124 klass->stop_auto_focus = NULL;
125 klass->set_focus_level = NULL;
126 klass->get_focus_level = NULL;
127 klass->set_auto_focus_area = NULL;
128 klass->get_auto_focus_area = NULL;
129 klass->set_wdr = NULL;
130 klass->get_wdr = NULL;
131 klass->set_ahs = NULL;
132 klass->get_ahs = NULL;
133 klass->set_part_color = NULL;
134 klass->get_part_color = NULL;
135 klass->get_exif_info = NULL;
136 klass->set_capture_command = NULL;
140 gst_camera_control_list_channels( GstCameraControl *control )
142 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
144 if( klass->list_channels )
146 return klass->list_channels( control );
154 gst_camera_control_set_value( GstCameraControl *control, GstCameraControlChannel *control_channel )
156 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
158 if( klass->set_value )
160 return klass->set_value( control, control_channel );
167 gst_camera_control_get_value( GstCameraControl *control, GstCameraControlChannel *control_channel )
169 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
171 if( klass->get_value )
173 return klass->get_value( control, control_channel );
182 gst_camera_control_set_exposure( GstCameraControl *control, gint type, gint value1, gint value2 )
184 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
186 if( klass->set_exposure )
188 return klass->set_exposure( control, type, value1, value2 );
195 gst_camera_control_get_exposure( GstCameraControl *control, gint type, gint* value1, gint* value2 )
197 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
199 if( klass->get_exposure )
201 return klass->get_exposure( control, type, value1, value2 );
208 gst_camera_control_set_capture_mode( GstCameraControl *control, gint type, gint value )
210 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
212 if( klass->set_capture_mode )
214 return klass->set_capture_mode( control, type, value );
221 gst_camera_control_get_capture_mode( GstCameraControl *control, gint type, gint *value )
223 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
225 if( klass->get_capture_mode )
227 return klass->get_capture_mode( control, type, value );
234 gst_camera_control_set_strobe( GstCameraControl *control, gint type, gint value )
236 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
238 if( klass->set_strobe )
240 return klass->set_strobe( control, type, value );
247 gst_camera_control_get_strobe( GstCameraControl *control, gint type, gint *value )
249 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
251 if( klass->get_strobe )
253 return klass->get_strobe( control, type, value );
260 gst_camera_control_set_detect( GstCameraControl *control, gint type, gint value )
262 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
264 if( klass->set_detect )
266 return klass->set_detect( control, type, value );
273 gst_camera_control_get_detect( GstCameraControl *control, gint type, gint *value )
275 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
277 if( klass->get_detect )
279 return klass->get_detect( control, type, value );
282 //for prevent MISSING_RETURN :+: yoserb.yi 2009-06-25
288 gst_camera_control_set_zoom( GstCameraControl *control, gint type, gint value )
290 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
292 if( klass->set_zoom )
294 return klass->set_zoom( control, type, value );
301 gst_camera_control_get_zoom( GstCameraControl *control, gint type, gint *value )
303 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
305 if( klass->get_zoom )
307 return klass->get_zoom( control, type, value );
314 gst_camera_control_set_focus( GstCameraControl *control, gint mode, gint range )
316 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
318 if( klass->set_focus )
320 return klass->set_focus( control, mode, range );
327 gst_camera_control_get_focus( GstCameraControl *control, gint *mode, gint *range )
329 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
331 if( klass->get_focus )
333 return klass->get_focus( control, mode, range );
340 gst_camera_control_start_auto_focus( GstCameraControl *control )
342 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
344 if( klass->start_auto_focus )
346 return klass->start_auto_focus( control );
353 gst_camera_control_stop_auto_focus( GstCameraControl *control )
355 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
357 if( klass->stop_auto_focus )
359 return klass->stop_auto_focus( control );
366 gst_camera_control_set_focus_level( GstCameraControl *control, gint manual_level)
368 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
370 if( klass->set_focus_level )
372 return klass->set_focus_level( control, manual_level );
379 gst_camera_control_get_focus_level( GstCameraControl *control, gint *manual_level)
381 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
383 if( klass->get_focus_level )
385 return klass->get_focus_level( control, manual_level );
392 gst_camera_control_set_auto_focus_area( GstCameraControl *control, GstCameraControlRectType rect )
394 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
396 if( klass->set_auto_focus_area )
398 return klass->set_auto_focus_area( control, rect );
405 gst_camera_control_get_auto_focus_area( GstCameraControl *control, GstCameraControlRectType* rect )
407 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
409 if( klass->get_auto_focus_area )
411 return klass->get_auto_focus_area( control, rect );
418 gst_camera_control_set_wdr( GstCameraControl *control, gint value)
420 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
424 return klass->set_wdr( control, value );
431 gst_camera_control_get_wdr( GstCameraControl *control, gint *value)
433 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
437 return klass->get_wdr( control, value );
444 gst_camera_control_set_ahs( GstCameraControl *control, gint value)
446 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
450 return klass->set_ahs( control, value );
457 gst_camera_control_get_ahs( GstCameraControl *control, gint *value)
459 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
463 return klass->get_ahs( control, value );
470 gst_camera_control_set_part_color( GstCameraControl *control, gint type, gint value)
472 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
474 if( klass->set_part_color )
476 return klass->set_part_color( control, type, value );
483 gst_camera_control_get_part_color( GstCameraControl *control, gint type, gint *value)
485 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
487 if( klass->get_part_color )
489 return klass->get_part_color( control, type, value );
496 gst_camera_control_get_exif_info ( GstCameraControl* control, GstCameraControlExifInfo* info)
498 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
500 if( klass->get_exif_info )
502 return klass->get_exif_info( control, info );
510 gst_camera_control_get_basic_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlCapsInfoType* info)
512 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
514 if( klass->get_basic_dev_info )
516 return klass->get_basic_dev_info( control, dev_id, info );
523 gst_camera_control_get_misc_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlCtrlListInfoType* info)
525 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
527 if( klass->get_misc_dev_info )
529 return klass->get_misc_dev_info( control, dev_id, info );
536 gst_camera_control_get_extra_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlExtraInfoType* info)
538 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
540 if( klass->get_extra_dev_info )
542 return klass->get_extra_dev_info( control, dev_id, info );
549 gst_camera_control_set_capture_command( GstCameraControl* control, GstCameraControlCaptureCommand cmd )
551 GstCameraControlClass *klass = GST_CAMERA_CONTROL_GET_CLASS( control );
553 if( klass->set_capture_command )
555 klass->set_capture_command( control, cmd );
562 gst_camera_control_value_changed( GstCameraControl *control, GstCameraControlChannel *control_channel, gint value )
564 g_signal_emit( G_OBJECT( control ), gst_camera_control_signals[CONTROL_VALUE_CHANGED], 0, control_channel, value );
566 g_signal_emit_by_name( G_OBJECT( control_channel ), "control-value-changed", value );