2 * GStreamer Camera Control Interface
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_NUM_DETECTED_FACES 16
176 #define MAX_SZ_CTRL_NAME_STRING 32
177 #define MAX_SZ_DEV_NAME_STRING 32
179 /*! @struct GstCameraControlFracType
180 * @brief For timeperframe as fraction type
181 * Elapse time consumed by one frame, reverse of FPS
183 typedef struct _GstCameraControlFracType {
186 } GstCameraControlFracType;
188 /*! @struct GstCameraControlRectType
189 * @brief For touch auto focusing area and face detection area
191 typedef struct _GstCameraControlRectType {
196 } GstCameraControlRectType;
198 /*! @struct GstCameraControlResolutionType
199 * @brief For querying supported resolutions
201 typedef struct _GstCameraControlResolutionType {
205 /* Available time per frame(tpf) as each pixelformat */
207 GstCameraControlFracType tpf[MAX_NUM_AVAILABLE_TPF];
208 } GstCameraControlResolutionType;
210 /*! @struct GstCameraControlFraction
211 * @brief Time per frame or frame per second will be expressed by this structure
212 * Time per frame or frame per second will be expressed by this structure
214 typedef struct _GstCameraControlFraction {
215 int numerator; /**< Upper number of fraction*/
216 int denominator; /**< Lower number of fraction*/
217 } GstCameraControlFraction;
219 /*! @struct GstCameraControlFmtDescType
220 * @brief For querying supported format type
222 typedef struct _GstCameraControlFmtDescType {
223 /* fourcc name of each pixelformat */
227 /* Available resolutions as each pixelformat */
229 GstCameraControlResolutionType resolutions[MAX_NUM_RESOLUTION];
230 } GstCameraControlFmtDescType;
232 /*! @struct GstCameraControlCapsInfoType
233 * @brief For querying image input capabilities
235 typedef struct _GstCameraControlCapsInfoType {
236 char dev_name[MAX_SZ_DEV_NAME_STRING];
239 GstCameraControlFmtDescType fmt_desc[MAX_NUM_FMT_DESC];
241 int num_preview_resolution;
242 int preview_resolution_width[MAX_NUM_RESOLUTION];
243 int preview_resolution_height[MAX_NUM_RESOLUTION];
245 int num_capture_resolution;
246 int capture_resolution_width[MAX_NUM_RESOLUTION];
247 int capture_resolution_height[MAX_NUM_RESOLUTION];
250 unsigned int preview_fmt[MAX_NUM_FMT_DESC];
253 unsigned int capture_fmt[MAX_NUM_FMT_DESC];
256 GstCameraControlFraction fps[MAX_NUM_AVAILABLE_FPS];
257 } GstCameraControlCapsInfoType;
259 /*! @struct GstCameraControlFaceInfo
260 * @brief For face information
262 typedef struct _GstCameraControlFaceInfo {
265 GstCameraControlRectType rect;
266 } GstCameraControlFaceInfo;
268 /*! @struct GstCameraControlFaceDetectInfo
269 * @brief For face detect information
271 typedef struct _GstCameraControlFaceDetectInfo {
273 GstCameraControlFaceInfo face_info[MAX_NUM_DETECTED_FACES];
274 } GstCameraControlFaceDetectInfo;
276 /////////////////////////////
277 // For Querying controls //
278 /////////////////////////////
280 GST_CAMERA_CTRL_TYPE_RANGE = 0,
281 GST_CAMERA_CTRL_TYPE_BOOL,
282 GST_CAMERA_CTRL_TYPE_ARRAY,
283 GST_CAMERA_CTRL_TYPE_UNKNOWN,
284 GST_CAMERA_CTRL_TYPE_NUM,
287 /*! @struct GstCameraControlCtrlMenuType
288 * @brief For querying menu of specified controls
290 typedef struct _GstCameraControlCtrlMenuType {
292 gchar menu_name[MAX_SZ_CTRL_NAME_STRING];
293 } GstCameraControlCtrlMenuType;
295 /*! @struct GstCameraControlCtrlInfoType
296 * @brief For querying controls detail
298 typedef struct _GstCameraControlCtrlInfoType {
302 gchar ctrl_name[MAX_SZ_CTRL_NAME_STRING];
308 GstCameraControlCtrlMenuType ctrl_menu[MAX_NUM_CTRL_MENU];
309 } GstCameraControlCtrlInfoType;
311 /*! @struct GstCameraControlCtrlListInfoType
312 * @brief For querying controls
314 typedef struct _GstCameraControlCtrlListInfoType {
315 gint num_ctrl_list_info;
316 GstCameraControlCtrlInfoType ctrl_info[MAX_NUM_CTRL_LIST_INFO];
317 } GstCameraControlCtrlListInfoType;
319 /* capabilities field */
320 #define GST_CAMERA_STROBE_CAP_NONE 0x0000 /* No strobe supported */
321 #define GST_CAMERA_STROBE_CAP_OFF 0x0001 /* Always flash off mode */
322 #define GST_CAMERA_STROBE_CAP_ON 0x0002 /* Always use flash light mode */
323 #define GST_CAMERA_STROBE_CAP_AUTO 0x0004 /* Flashlight works automatic */
324 #define GST_CAMERA_STROBE_CAP_REDEYE 0x0008 /* Red-eye reduction */
325 #define GST_CAMERA_STROBE_CAP_SLOWSYNC 0x0010 /* Slow sync */
326 #define GST_CAMERA_STROBE_CAP_FRONT_CURTAIN 0x0020 /* Front curtain */
327 #define GST_CAMERA_STROBE_CAP_REAR_CURTAIN 0x0040 /* Rear curtain */
328 #define GST_CAMERA_STROBE_CAP_PERMANENT 0x0080 /* keep turned on until turning off */
329 #define GST_CAMERA_STROBE_CAP_EXTERNAL 0x0100 /* use external strobe */
331 typedef struct _GstCameraControlExtraInfoType {
332 guint strobe_caps; /**< Use above caps field */
333 guint detection_caps; /**< Just boolean */
335 } GstCameraControlExtraInfoType;
336 /////////////////////////////////////
337 // END For Query functionalities //
338 /////////////////////////////////////
342 * Enumerations for Camera control Part color.
344 typedef struct _GstCameraControlExifInfo {
346 guint32 exposure_time_numerator; /* Exposure time, given in seconds */
347 guint32 exposure_time_denominator;
348 gint shutter_speed_numerator; /* Shutter speed, given in APEX(Additive System Photographic Exposure) */
349 gint shutter_speed_denominator;
350 gint brigtness_numerator; /* Value of brightness, before firing flash, given in APEX value */
351 gint brightness_denominator;
352 guint16 iso; /* Sensitivity value of sensor */
353 guint16 flash; /* Whether flash is fired(1) or not(0) */
354 gint metering_mode; /* metering mode in EXIF 2.2 */
355 gint exif_image_width; /* Size of image */
356 gint exif_image_height;
357 gint exposure_bias_in_APEX; /* Exposure bias in APEX standard */
358 gint software_used; /* Firmware S/W version */
361 gint component_configuration; /* color components arrangement */
362 gint colorspace; /* colorspace information */
363 gint focal_len_numerator; /* Lens focal length */
364 gint focal_len_denominator;
365 gint aperture_f_num_numerator; /* Aperture value */
366 gint aperture_f_num_denominator;
367 gint aperture_in_APEX; /* Aperture value in APEX standard */
368 gint max_lens_aperture_in_APEX; /* Max aperture value in APEX standard */
369 } GstCameraControlExifInfo;
372 typedef struct _GstCameraControlClass {
373 GTypeInterface klass;
374 GstCameraControlType camera_control_type;
376 /* virtual functions */
377 const GList*(*list_channels) (GstCameraControl *control);
379 gboolean (*set_value) (GstCameraControl *control, GstCameraControlChannel *control_channel);
380 gboolean (*get_value) (GstCameraControl *control, GstCameraControlChannel *control_channel);
381 gboolean (*set_exposure) (GstCameraControl *control, gint type, gint value1, gint value2);
382 gboolean (*get_exposure) (GstCameraControl *control, gint type, gint *value1, gint *value2);
383 gboolean (*set_capture_mode) (GstCameraControl *control, gint type, gint value);
384 gboolean (*get_capture_mode) (GstCameraControl *control, gint type, gint *value);
385 gboolean (*set_strobe) (GstCameraControl *control, gint type, gint value);
386 gboolean (*get_strobe) (GstCameraControl *control, gint type, gint *value);
387 gboolean (*set_detect) (GstCameraControl *control, gint type, gint value);
388 gboolean (*get_detect) (GstCameraControl *control, gint type, gint *value);
389 gboolean (*set_zoom) (GstCameraControl *control, gint type, gint value);
390 gboolean (*get_zoom) (GstCameraControl *control, gint type, gint *value);
391 gboolean (*set_focus) (GstCameraControl *control, gint mode, gint range);
392 gboolean (*get_focus) (GstCameraControl *control, gint *mode, gint *range);
393 gboolean (*start_auto_focus) (GstCameraControl *control);
394 gboolean (*stop_auto_focus) (GstCameraControl *control);
395 gboolean (*set_focus_level) (GstCameraControl *control, gint manual_level);
396 gboolean (*get_focus_level) (GstCameraControl *control, gint *manual_level);
397 gboolean (*set_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType rect);
398 gboolean (*get_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType *rect);
399 gboolean (*set_wdr) (GstCameraControl *control, gint value);
400 gboolean (*get_wdr) (GstCameraControl *control, gint *value);
401 gboolean (*set_ahs) (GstCameraControl *control, gint value);
402 gboolean (*get_ahs) (GstCameraControl *control, gint *value);
403 gboolean (*set_part_color) (GstCameraControl *control, gint type, gint value);
404 gboolean (*get_part_color) (GstCameraControl *control, gint type, gint *value);
405 gboolean (*get_exif_info) (GstCameraControl *control, GstCameraControlExifInfo *info);
406 gboolean (*get_basic_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
407 gboolean (*get_misc_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
408 gboolean (*get_extra_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
409 void (*set_capture_command) (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
410 gboolean (*start_face_zoom) (GstCameraControl *control, gint x, gint y, gint zoom_level);
411 gboolean (*stop_face_zoom) (GstCameraControl *control);
414 void (* value_changed) (GstCameraControl *control, GstCameraControlChannel *channel, gint value);
415 } GstCameraControlClass;
417 GType gst_camera_control_get_type(void);
419 /* virtual class function wrappers */
420 const GList* gst_camera_control_list_channels (GstCameraControl *control);
422 gboolean gst_camera_control_set_value (GstCameraControl *control, GstCameraControlChannel *control_channel);
423 gboolean gst_camera_control_get_value (GstCameraControl *control, GstCameraControlChannel *control_channel);
424 gboolean gst_camera_control_set_exposure (GstCameraControl *control, gint type, gint value1, gint value2);
425 gboolean gst_camera_control_get_exposure (GstCameraControl *control, gint type, gint *value1, gint *value2);
426 gboolean gst_camera_control_set_capture_mode (GstCameraControl *control, gint type, gint value);
427 gboolean gst_camera_control_get_capture_mode (GstCameraControl *control, gint type, gint *value);
428 gboolean gst_camera_control_set_strobe (GstCameraControl *control, gint type, gint value);
429 gboolean gst_camera_control_get_strobe (GstCameraControl *control, gint type, gint *value);
430 gboolean gst_camera_control_set_detect (GstCameraControl *control, gint type, gint value);
431 gboolean gst_camera_control_get_detect (GstCameraControl *control, gint type, gint *value);
432 gboolean gst_camera_control_set_zoom (GstCameraControl *control, gint type, gint value);
433 gboolean gst_camera_control_get_zoom (GstCameraControl *control, gint type, gint *value);
434 gboolean gst_camera_control_set_focus (GstCameraControl *control, gint mode, gint range);
435 gboolean gst_camera_control_get_focus (GstCameraControl *control, gint *mode, gint *range);
436 gboolean gst_camera_control_start_auto_focus (GstCameraControl *control);
437 gboolean gst_camera_control_stop_auto_focus (GstCameraControl *control);
438 gboolean gst_camera_control_set_focus_level (GstCameraControl *control, gint manual_level);
439 gboolean gst_camera_control_get_focus_level (GstCameraControl *control, gint *manual_level);
440 gboolean gst_camera_control_set_auto_focus_area (GstCameraControl *control, GstCameraControlRectType rect);
441 gboolean gst_camera_control_get_auto_focus_area (GstCameraControl *control, GstCameraControlRectType *rect);
442 gboolean gst_camera_control_set_wdr (GstCameraControl *control, gint value);
443 gboolean gst_camera_control_get_wdr (GstCameraControl *control, gint *value);
444 gboolean gst_camera_control_set_ahs (GstCameraControl *control, gint value);
445 gboolean gst_camera_control_get_ahs (GstCameraControl *control, gint *value);
446 gboolean gst_camera_control_set_part_color (GstCameraControl *control, gint type, gint value);
447 gboolean gst_camera_control_get_part_color (GstCameraControl *control, gint type, gint *value);
448 gboolean gst_camera_control_get_exif_info (GstCameraControl *control, GstCameraControlExifInfo *info);
449 gboolean gst_camera_control_get_basic_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
450 gboolean gst_camera_control_get_misc_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
451 gboolean gst_camera_control_get_extra_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
452 void gst_camera_control_set_capture_command (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
453 gboolean gst_camera_control_start_face_zoom (GstCameraControl *control, gint x, gint y, gint zoom_level);
454 gboolean gst_camera_control_stop_face_zoom (GstCameraControl *control);
458 void gst_camera_control_value_changed (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
462 #endif /* __GST_CAMERA_CONTROL_H__ */