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 =========================================================================================== */
36 #ifndef __GST_CAMERA_CONTROL_H__
37 #define __GST_CAMERA_CONTROL_H__
40 #include <gst/interfaces/cameracontrolchannel.h>
41 #include <gst/interfaces/interfaces-enumtypes.h>
45 #define GST_TYPE_CAMERA_CONTROL \
46 (gst_camera_control_get_type())
47 #define GST_CAMERA_CONTROL(obj) \
48 (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_CAMERA_CONTROL, GstCameraControl))
49 #define GST_CAMERA_CONTROL_GET_CLASS(inst) \
50 (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_CAMERA_CONTROL, GstCameraControlClass))
51 #define GST_CAMERA_CONTROL_CLASS(klass) \
52 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_CAMERA_CONTROL, GstCameraControlClass))
53 #define GST_IS_CAMERA_CONTROL(obj) \
54 (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_CAMERA_CONTROL))
55 #define GST_IS_CAMERA_CONTROL_CLASS(klass) \
56 (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_CAMERA_CONTROL))
57 #define GST_CAMERA_CONTROL_TYPE(klass) (klass->camera_control_type)
60 typedef struct _GstCameraControl GstCameraControl;
65 GST_CAMERA_CONTROL_HARDWARE,
66 GST_CAMERA_CONTROL_SOFTWARE,
67 } GstCameraControlType;
70 * Enumerations for Camera control Exposure types.
74 GST_CAMERA_CONTROL_F_NUMBER,
75 GST_CAMERA_CONTROL_SHUTTER_SPEED,
76 GST_CAMERA_CONTROL_ISO,
77 GST_CAMERA_CONTROL_PROGRAM_MODE,
78 GST_CAMERA_CONTROL_EXPOSURE_MODE,
79 GST_CAMERA_CONTROL_EXPOSURE_VALUE,
80 } GstCameraControlExposureType;
83 * Enumerations for Camera control Capture mode types.
87 GST_CAMERA_CONTROL_CAPTURE_MODE,
88 GST_CAMERA_CONTROL_OUTPUT_MODE,
89 GST_CAMERA_CONTROL_FRAME_COUNT,
90 GST_CAMERA_CONTROL_JPEG_QUALITY,
91 } GstCameraControlCaptureModeType;
94 * Enumerations for Capture mode types.
98 CAPTURE_MODE_SINGLE_SHOT,
99 CAPTURE_MODE_MULTI_SHOT,
100 CAPTURE_MODE_ANTI_HANDSHAKE,
104 * Enumerations for Camera control Strobe types.
108 GST_CAMERA_CONTROL_STROBE_CONTROL,
109 GST_CAMERA_CONTROL_STROBE_CAPABILITIES,
110 GST_CAMERA_CONTROL_STROBE_MODE,
111 GST_CAMERA_CONTROL_STROBE_STATUS,
112 GST_CAMERA_CONTROL_STROBE_EV,
113 } GstCameraControlStrobeType;
116 * Enumerations for Camera control Face detection types.
120 GST_CAMERA_CONTROL_FACE_DETECT_MODE,
121 GST_CAMERA_CONTROL_FACE_DETECT_NUMBER,
122 GST_CAMERA_CONTROL_FACE_FOCUS_SELECT,
123 GST_CAMERA_CONTROL_FACE_SELECT_NUMBER,
124 GST_CAMERA_CONTROL_FACE_DETECT_STATUS,
125 } GstCameraControlFaceDetectType;
128 * Enumerations for Camera control Zoom types.
132 GST_CAMERA_CONTROL_DIGITAL_ZOOM,
133 GST_CAMERA_CONTROL_OPTICAL_ZOOM,
134 } GstCameraControlZoomType;
137 * Enumerations for Camera control Part color.
141 GST_CAMERA_CONTROL_PART_COLOR_SRC,
142 GST_CAMERA_CONTROL_PART_COLOR_DST,
143 GST_CAMERA_CONTROL_PART_COLOR_MODE,
144 } GstCameraControlPartColorType;
147 * Enumerations for Camera capture command.
151 GST_CAMERA_CONTROL_CAPTURE_COMMAND_NONE,
152 GST_CAMERA_CONTROL_CAPTURE_COMMAND_START,
153 GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP,
154 GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT,
155 } GstCameraControlCaptureCommand;
159 /////////////////////////////////
160 // For Query functionalities //
161 // For Querying capabilities //
162 /////////////////////////////////
163 /*! Use static size of structures for querying because of performance
166 * Don't modify this sizes
167 * If want to modify this size, consider also under layer structure size
169 #define MAX_NUM_FMT_DESC 32
170 #define MAX_NUM_RESOLUTION 32
171 #define MAX_NUM_AVAILABLE_TPF 16
172 #define MAX_NUM_AVAILABLE_FPS 16
173 #define MAX_NUM_CTRL_LIST_INFO 64
174 #define MAX_NUM_CTRL_MENU 64
175 #define MAX_SZ_CTRL_NAME_STRING 32
176 #define MAX_SZ_DEV_NAME_STRING 32
178 /*! @struct GstCameraControlFracType
179 * @brief For timeperframe as fraction type
180 * Elapse time consumed by one frame, reverse of FPS
185 }GstCameraControlFracType;
187 /*! @struct GstCameraControlRectType
188 * @brief For touch auto focusing area
195 }GstCameraControlRectType;
197 /*! @struct GstCameraControlResolutionType
198 * @brief For querying supported resolutions
204 /* Available time per frame(tpf) as each pixelformat */
206 GstCameraControlFracType tpf[MAX_NUM_AVAILABLE_TPF];
207 } GstCameraControlResolutionType;
209 /*! @struct GstCameraControlFraction
210 * @brief Time per frame or frame per second will be expressed by this structure
211 * Time per frame or frame per second will be expressed by this structure
214 int numerator; /**< Upper number of fraction*/
215 int denominator; /**< Lower number of fraction*/
216 } GstCameraControlFraction;
218 /*! @struct GstCameraControlFmtDescType
219 * @brief For querying supported format type
222 /* fourcc name of each pixelformat */
226 /* Available resolutions as each pixelformat */
228 GstCameraControlResolutionType resolutions[MAX_NUM_RESOLUTION];
229 } GstCameraControlFmtDescType;
231 /*! @struct GstCameraControlCapsInfoType
232 * @brief For querying image input capabilities
235 char dev_name[MAX_SZ_DEV_NAME_STRING];
238 GstCameraControlFmtDescType fmt_desc[MAX_NUM_FMT_DESC];
240 int num_preview_resolution;
241 int preview_resolution_width[MAX_NUM_RESOLUTION];
242 int preview_resolution_height[MAX_NUM_RESOLUTION];
244 int num_capture_resolution;
245 int capture_resolution_width[MAX_NUM_RESOLUTION];
246 int capture_resolution_height[MAX_NUM_RESOLUTION];
249 unsigned int preview_fmt[MAX_NUM_FMT_DESC];
252 unsigned int capture_fmt[MAX_NUM_FMT_DESC];
255 GstCameraControlFraction fps[MAX_NUM_AVAILABLE_FPS];
256 } GstCameraControlCapsInfoType;
258 /////////////////////////////
259 // For Querying controls //
260 /////////////////////////////
262 GST_CAMERA_CTRL_TYPE_RANGE = 0,
263 GST_CAMERA_CTRL_TYPE_BOOL,
264 GST_CAMERA_CTRL_TYPE_ARRAY,
265 GST_CAMERA_CTRL_TYPE_UNKNOWN,
266 GST_CAMERA_CTRL_TYPE_NUM,
269 /*! @struct GstCameraControlCtrlMenuType
270 * @brief For querying menu of specified controls
274 gchar menu_name[MAX_SZ_CTRL_NAME_STRING];
275 }GstCameraControlCtrlMenuType;
277 /*! @struct GstCameraControlCtrlInfoType
278 * @brief For querying controls detail
284 gchar ctrl_name[MAX_SZ_CTRL_NAME_STRING];
290 GstCameraControlCtrlMenuType ctrl_menu[MAX_NUM_CTRL_MENU];
291 } GstCameraControlCtrlInfoType;
293 /*! @struct GstCameraControlCtrlListInfoType
294 * @brief For querying controls
297 gint num_ctrl_list_info;
298 GstCameraControlCtrlInfoType ctrl_info[MAX_NUM_CTRL_LIST_INFO];
299 } GstCameraControlCtrlListInfoType;
301 /* capabilities field */
302 #define GST_CAMERA_STROBE_CAP_NONE 0x0000 /* No strobe supported */
303 #define GST_CAMERA_STROBE_CAP_OFF 0x0001 /* Always flash off mode */
304 #define GST_CAMERA_STROBE_CAP_ON 0x0002 /* Always use flash light mode */
305 #define GST_CAMERA_STROBE_CAP_AUTO 0x0004 /* Flashlight works automatic */
306 #define GST_CAMERA_STROBE_CAP_REDEYE 0x0008 /* Red-eye reduction */
307 #define GST_CAMERA_STROBE_CAP_SLOWSYNC 0x0010 /* Slow sync */
308 #define GST_CAMERA_STROBE_CAP_FRONT_CURTAIN 0x0020 /* Front curtain */
309 #define GST_CAMERA_STROBE_CAP_REAR_CURTAIN 0x0040 /* Rear curtain */
310 #define GST_CAMERA_STROBE_CAP_PERMANENT 0x0080 /* keep turned on until turning off */
311 #define GST_CAMERA_STROBE_CAP_EXTERNAL 0x0100 /* use external strobe */
314 guint strobe_caps; /**< Use above caps field */
315 guint detection_caps; /**< Just boolean */
317 } GstCameraControlExtraInfoType;
318 /////////////////////////////////////
319 // END For Query functionalities //
320 /////////////////////////////////////
324 * Enumerations for Camera control Part color.
326 typedef struct _GstCameraControlExifInfo
329 guint32 exposure_time_numerator; //Exposure time, given in seconds
330 guint32 exposure_time_denominator;
331 gint shutter_speed_numerator; //Shutter speed, given in APEX(Additive System Photographic Exposure)
332 gint shutter_speed_denominator;
333 gint brigtness_numerator; //Value of brightness, before firing flash, given in APEX value
334 gint brightness_denominator;
335 guint16 iso; //Sensitivity value of sensor
336 guint16 flash; //Whether flash is fired(1) or not(0)
337 gint metering_mode; //metering mode in EXIF 2.2
338 gint exif_image_width; //Size of image
339 gint exif_image_height; //
340 gint exposure_bias_in_APEX; //Exposure bias in APEX standard
341 gint software_used; //Firmware S/W version
345 gint component_configuration; //color components arrangement (YCbCr = 1230)
346 gint colorspace; //colorspace information (sRGB=1)
347 gint focal_len_numerator; //Lens focal length (f = 4.5mm)
348 gint focal_len_denominator;
349 gint aperture_f_num_numerator; //Aperture value (f_num = 2.8)
350 gint aperture_f_num_denominator;
351 gint aperture_in_APEX; //Aperture value in APEX standard
352 gint max_lens_aperture_in_APEX; //Max aperture value in APEX standard
353 } GstCameraControlExifInfo;
356 typedef struct _GstCameraControlClass {
357 GTypeInterface klass;
358 GstCameraControlType camera_control_type;
360 /* virtual functions */
361 const GList*(* list_channels) ( GstCameraControl* control );
363 gboolean (* set_value) ( GstCameraControl* control, GstCameraControlChannel* control_channel );
364 gboolean (* get_value) ( GstCameraControl* control, GstCameraControlChannel* control_channel );
365 gboolean (* set_exposure) ( GstCameraControl* control, gint type, gint value1, gint value2 );
366 gboolean (* get_exposure) ( GstCameraControl* control, gint type, gint* value1, gint* value2 );
367 gboolean (* set_capture_mode) ( GstCameraControl* control, gint type, gint value );
368 gboolean (* get_capture_mode) ( GstCameraControl* control, gint type, gint* value );
369 gboolean (* set_strobe) ( GstCameraControl* control, gint type, gint value );
370 gboolean (* get_strobe) ( GstCameraControl* control, gint type, gint *value );
371 gboolean (* set_detect) ( GstCameraControl* control, gint type, gint value );
372 gboolean (* get_detect) ( GstCameraControl* control, gint type, gint* value );
373 gboolean (* set_zoom) ( GstCameraControl* control, gint type, gint value );
374 gboolean (* get_zoom) ( GstCameraControl* control, gint type, gint* value );
375 gboolean (* set_focus) ( GstCameraControl* control, gint mode, gint range );
376 gboolean (* get_focus) ( GstCameraControl* control, gint* mode, gint* range );
377 gboolean (* start_auto_focus) ( GstCameraControl* control);
378 gboolean (* stop_auto_focus) ( GstCameraControl* control);
379 gboolean (* set_focus_level) ( GstCameraControl* control, gint manual_level);
380 gboolean (* get_focus_level) ( GstCameraControl* control, gint* manual_level);
381 gboolean (* set_auto_focus_area) ( GstCameraControl* control, GstCameraControlRectType rect );
382 gboolean (* get_auto_focus_area) ( GstCameraControl* control, GstCameraControlRectType* rect );
383 gboolean (* set_wdr) ( GstCameraControl* control, gint value);
384 gboolean (* get_wdr) ( GstCameraControl* control, gint *value);
385 gboolean (* set_ahs) ( GstCameraControl* control, gint value);
386 gboolean (* get_ahs) ( GstCameraControl* control, gint *value);
387 gboolean (* set_part_color) ( GstCameraControl* control, gint type, gint value);
388 gboolean (* get_part_color) ( GstCameraControl* control, gint type, gint* value);
389 gboolean (* get_exif_info) ( GstCameraControl* control, GstCameraControlExifInfo* info);
390 gboolean (* get_basic_dev_info) ( GstCameraControl* control, gint dev_id, GstCameraControlCapsInfoType* info);
391 gboolean (* get_misc_dev_info) ( GstCameraControl* control, gint dev_id, GstCameraControlCtrlListInfoType* info);
392 gboolean (* get_extra_dev_info) ( GstCameraControl* control, gint dev_id, GstCameraControlExtraInfoType* info);
393 void (* set_capture_command) ( GstCameraControl* control, GstCameraControlCaptureCommand cmd );
396 void (* value_changed) ( GstCameraControl* control, GstCameraControlChannel* channel, gint value );
397 } GstCameraControlClass;
399 GType gst_camera_control_get_type (void);
401 /* virtual class function wrappers */
402 const GList* gst_camera_control_list_channels ( GstCameraControl* control );
404 gboolean gst_camera_control_set_value ( GstCameraControl* control, GstCameraControlChannel* control_channel );
405 gboolean gst_camera_control_get_value ( GstCameraControl* control, GstCameraControlChannel* control_channel );
406 gboolean gst_camera_control_set_exposure ( GstCameraControl* control, gint type, gint value1, gint value2 );
407 gboolean gst_camera_control_get_exposure ( GstCameraControl* control, gint type, gint* value1, gint* value2 );
408 gboolean gst_camera_control_set_capture_mode ( GstCameraControl* control, gint type, gint value );
409 gboolean gst_camera_control_get_capture_mode ( GstCameraControl* control, gint type, gint* value );
410 gboolean gst_camera_control_set_strobe ( GstCameraControl* control, gint type, gint value );
411 gboolean gst_camera_control_get_strobe ( GstCameraControl* control, gint type, gint *value );
412 gboolean gst_camera_control_set_detect ( GstCameraControl* control, gint type, gint value );
413 gboolean gst_camera_control_get_detect ( GstCameraControl* control, gint type, gint* value );
414 gboolean gst_camera_control_set_zoom ( GstCameraControl* control, gint type, gint value );
415 gboolean gst_camera_control_get_zoom ( GstCameraControl* control, gint type, gint* value );
416 gboolean gst_camera_control_set_focus ( GstCameraControl* control, gint mode, gint range );
417 gboolean gst_camera_control_get_focus ( GstCameraControl* control, gint* mode, gint* range );
418 gboolean gst_camera_control_start_auto_focus ( GstCameraControl* control);
419 gboolean gst_camera_control_stop_auto_focus ( GstCameraControl* control);
420 gboolean gst_camera_control_set_focus_level ( GstCameraControl* control, gint manual_level );
421 gboolean gst_camera_control_get_focus_level ( GstCameraControl* control, gint* manual_level );
422 gboolean gst_camera_control_set_auto_focus_area ( GstCameraControl* control, GstCameraControlRectType rect );
423 gboolean gst_camera_control_get_auto_focus_area ( GstCameraControl* control, GstCameraControlRectType* rect );
424 gboolean gst_camera_control_set_wdr ( GstCameraControl* control, gint value);
425 gboolean gst_camera_control_get_wdr ( GstCameraControl* control, gint* value);
426 gboolean gst_camera_control_set_ahs ( GstCameraControl* control, gint value);
427 gboolean gst_camera_control_get_ahs ( GstCameraControl* control, gint* value);
428 gboolean gst_camera_control_set_part_color ( GstCameraControl* control, gint type, gint value);
429 gboolean gst_camera_control_get_part_color ( GstCameraControl* control, gint type, gint* value);
430 gboolean gst_camera_control_get_exif_info ( GstCameraControl* control, GstCameraControlExifInfo* info);
431 gboolean gst_camera_control_get_basic_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlCapsInfoType* info);
432 gboolean gst_camera_control_get_misc_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlCtrlListInfoType* info);
433 gboolean gst_camera_control_get_extra_dev_info ( GstCameraControl* control, gint dev_id, GstCameraControlExtraInfoType* info);
434 void gst_camera_control_set_capture_command ( GstCameraControl* control, GstCameraControlCaptureCommand cmd );
438 void gst_camera_control_value_changed ( GstCameraControl* control, GstCameraControlChannel* control_channel, gint value );
442 #endif /* __GST_CAMERA_CONTROL_H__ */