2 * GStreamer Camera Control Interface
4 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd.
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;
158 * Enumerations for Camera record command.
162 GST_CAMERA_CONTROL_RECORD_COMMAND_NONE,
163 GST_CAMERA_CONTROL_RECORD_COMMAND_START,
164 GST_CAMERA_CONTROL_RECORD_COMMAND_STOP,
165 } GstCameraControlRecordCommand;
167 /////////////////////////////////
168 // For Query functionalities //
169 // For Querying capabilities //
170 /////////////////////////////////
171 /*! Use static size of structures for querying because of performance
174 * Don't modify this sizes
175 * If want to modify this size, consider also under layer structure size
177 #define MAX_NUM_FMT_DESC 32
178 #define MAX_NUM_RESOLUTION 32
179 #define MAX_NUM_AVAILABLE_TPF 16
180 #define MAX_NUM_AVAILABLE_FPS 16
181 #define MAX_NUM_CTRL_LIST_INFO 64
182 #define MAX_NUM_CTRL_MENU 64
183 #define MAX_NUM_DETECTED_FACES 16
184 #define MAX_SZ_CTRL_NAME_STRING 32
185 #define MAX_SZ_DEV_NAME_STRING 32
187 /*! @struct GstCameraControlFracType
188 * @brief For timeperframe as fraction type
189 * Elapse time consumed by one frame, reverse of FPS
191 typedef struct _GstCameraControlFracType {
194 } GstCameraControlFracType;
196 /*! @struct GstCameraControlRectType
197 * @brief For touch auto focusing area and face detection area
199 typedef struct _GstCameraControlRectType {
204 } GstCameraControlRectType;
206 /*! @struct GstCameraControlResolutionType
207 * @brief For querying supported resolutions
209 typedef struct _GstCameraControlResolutionType {
213 /* Available time per frame(tpf) as each pixelformat */
215 GstCameraControlFracType tpf[MAX_NUM_AVAILABLE_TPF];
216 } GstCameraControlResolutionType;
218 /*! @struct GstCameraControlFraction
219 * @brief Time per frame or frame per second will be expressed by this structure
220 * Time per frame or frame per second will be expressed by this structure
222 typedef struct _GstCameraControlFraction {
223 int numerator; /**< Upper number of fraction*/
224 int denominator; /**< Lower number of fraction*/
225 } GstCameraControlFraction;
227 /*! @struct GstCameraControlFmtDescType
228 * @brief For querying supported format type
230 typedef struct _GstCameraControlFmtDescType {
231 /* fourcc name of each pixelformat */
235 /* Available resolutions as each pixelformat */
237 GstCameraControlResolutionType resolutions[MAX_NUM_RESOLUTION];
238 } GstCameraControlFmtDescType;
240 /*! @struct GstCameraControlCapsInfoType
241 * @brief For querying image input capabilities
243 typedef struct _GstCameraControlCapsInfoType {
244 char dev_name[MAX_SZ_DEV_NAME_STRING];
247 GstCameraControlFmtDescType fmt_desc[MAX_NUM_FMT_DESC];
249 int num_preview_resolution;
250 int preview_resolution_width[MAX_NUM_RESOLUTION];
251 int preview_resolution_height[MAX_NUM_RESOLUTION];
253 int num_capture_resolution;
254 int capture_resolution_width[MAX_NUM_RESOLUTION];
255 int capture_resolution_height[MAX_NUM_RESOLUTION];
258 unsigned int preview_fmt[MAX_NUM_FMT_DESC];
261 unsigned int capture_fmt[MAX_NUM_FMT_DESC];
264 GstCameraControlFraction fps[MAX_NUM_AVAILABLE_FPS];
265 } GstCameraControlCapsInfoType;
267 /*! @struct GstCameraControlFaceInfo
268 * @brief For face information
270 typedef struct _GstCameraControlFaceInfo {
273 GstCameraControlRectType rect;
274 } GstCameraControlFaceInfo;
276 /*! @struct GstCameraControlFaceDetectInfo
277 * @brief For face detect information
279 typedef struct _GstCameraControlFaceDetectInfo {
281 GstCameraControlFaceInfo face_info[MAX_NUM_DETECTED_FACES];
282 } GstCameraControlFaceDetectInfo;
284 /////////////////////////////
285 // For Querying controls //
286 /////////////////////////////
288 GST_CAMERA_CTRL_TYPE_RANGE = 0,
289 GST_CAMERA_CTRL_TYPE_BOOL,
290 GST_CAMERA_CTRL_TYPE_ARRAY,
291 GST_CAMERA_CTRL_TYPE_UNKNOWN,
292 GST_CAMERA_CTRL_TYPE_NUM,
295 /*! @struct GstCameraControlCtrlMenuType
296 * @brief For querying menu of specified controls
298 typedef struct _GstCameraControlCtrlMenuType {
300 gchar menu_name[MAX_SZ_CTRL_NAME_STRING];
301 } GstCameraControlCtrlMenuType;
303 /*! @struct GstCameraControlCtrlInfoType
304 * @brief For querying controls detail
306 typedef struct _GstCameraControlCtrlInfoType {
310 gchar ctrl_name[MAX_SZ_CTRL_NAME_STRING];
316 GstCameraControlCtrlMenuType ctrl_menu[MAX_NUM_CTRL_MENU];
317 } GstCameraControlCtrlInfoType;
319 /*! @struct GstCameraControlCtrlListInfoType
320 * @brief For querying controls
322 typedef struct _GstCameraControlCtrlListInfoType {
323 gint num_ctrl_list_info;
324 GstCameraControlCtrlInfoType ctrl_info[MAX_NUM_CTRL_LIST_INFO];
325 } GstCameraControlCtrlListInfoType;
327 /* capabilities field */
328 #define GST_CAMERA_STROBE_CAP_NONE 0x0000 /* No strobe supported */
329 #define GST_CAMERA_STROBE_CAP_OFF 0x0001 /* Always flash off mode */
330 #define GST_CAMERA_STROBE_CAP_ON 0x0002 /* Always use flash light mode */
331 #define GST_CAMERA_STROBE_CAP_AUTO 0x0004 /* Flashlight works automatic */
332 #define GST_CAMERA_STROBE_CAP_REDEYE 0x0008 /* Red-eye reduction */
333 #define GST_CAMERA_STROBE_CAP_SLOWSYNC 0x0010 /* Slow sync */
334 #define GST_CAMERA_STROBE_CAP_FRONT_CURTAIN 0x0020 /* Front curtain */
335 #define GST_CAMERA_STROBE_CAP_REAR_CURTAIN 0x0040 /* Rear curtain */
336 #define GST_CAMERA_STROBE_CAP_PERMANENT 0x0080 /* keep turned on until turning off */
337 #define GST_CAMERA_STROBE_CAP_EXTERNAL 0x0100 /* use external strobe */
339 typedef struct _GstCameraControlExtraInfoType {
340 guint strobe_caps; /**< Use above caps field */
341 guint detection_caps; /**< Just boolean */
343 } GstCameraControlExtraInfoType;
344 /////////////////////////////////////
345 // END For Query functionalities //
346 /////////////////////////////////////
350 * Enumerations for Camera control Part color.
352 typedef struct _GstCameraControlExifInfo {
354 guint32 exposure_time_numerator; /* Exposure time, given in seconds */
355 guint32 exposure_time_denominator;
356 gint shutter_speed_numerator; /* Shutter speed, given in APEX(Additive System Photographic Exposure) */
357 gint shutter_speed_denominator;
358 gint brigtness_numerator; /* Value of brightness, before firing flash, given in APEX value */
359 gint brightness_denominator;
360 guint16 iso; /* Sensitivity value of sensor */
361 guint16 flash; /* Whether flash is fired(1) or not(0) */
362 gint metering_mode; /* metering mode in EXIF 2.2 */
363 gint exif_image_width; /* Size of image */
364 gint exif_image_height;
365 gint exposure_bias_in_APEX; /* Exposure bias in APEX standard */
366 gint software_used; /* Firmware S/W version */
367 unsigned char *p_embedded_data; /* Pointer for embedded data */
370 gint component_configuration; /* color components arrangement */
371 gint colorspace; /* colorspace information */
372 gint focal_len_numerator; /* Lens focal length */
373 gint focal_len_denominator;
374 gint aperture_f_num_numerator; /* Aperture value */
375 gint aperture_f_num_denominator;
376 gint aperture_in_APEX; /* Aperture value in APEX standard */
377 gint max_lens_aperture_in_APEX; /* Max aperture value in APEX standard */
378 } GstCameraControlExifInfo;
381 typedef struct _GstCameraControlClass {
382 GTypeInterface klass;
383 GstCameraControlType camera_control_type;
385 /* virtual functions */
386 const GList*(*list_channels) (GstCameraControl *control);
388 gboolean (*set_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
389 gboolean (*get_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value);
390 gboolean (*set_exposure) (GstCameraControl *control, gint type, gint value1, gint value2);
391 gboolean (*get_exposure) (GstCameraControl *control, gint type, gint *value1, gint *value2);
392 gboolean (*set_capture_mode) (GstCameraControl *control, gint type, gint value);
393 gboolean (*get_capture_mode) (GstCameraControl *control, gint type, gint *value);
394 gboolean (*set_strobe) (GstCameraControl *control, gint type, gint value);
395 gboolean (*get_strobe) (GstCameraControl *control, gint type, gint *value);
396 gboolean (*set_detect) (GstCameraControl *control, gint type, gint value);
397 gboolean (*get_detect) (GstCameraControl *control, gint type, gint *value);
398 gboolean (*set_zoom) (GstCameraControl *control, gint type, gint value);
399 gboolean (*get_zoom) (GstCameraControl *control, gint type, gint *value);
400 gboolean (*set_focus) (GstCameraControl *control, gint mode, gint range);
401 gboolean (*get_focus) (GstCameraControl *control, gint *mode, gint *range);
402 gboolean (*start_auto_focus) (GstCameraControl *control);
403 gboolean (*stop_auto_focus) (GstCameraControl *control);
404 gboolean (*set_focus_level) (GstCameraControl *control, gint manual_level);
405 gboolean (*get_focus_level) (GstCameraControl *control, gint *manual_level);
406 gboolean (*set_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType rect);
407 gboolean (*get_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType *rect);
408 gboolean (*set_wdr) (GstCameraControl *control, gint value);
409 gboolean (*get_wdr) (GstCameraControl *control, gint *value);
410 gboolean (*set_ahs) (GstCameraControl *control, gint value);
411 gboolean (*get_ahs) (GstCameraControl *control, gint *value);
412 gboolean (*set_part_color) (GstCameraControl *control, gint type, gint value);
413 gboolean (*get_part_color) (GstCameraControl *control, gint type, gint *value);
414 gboolean (*get_exif_info) (GstCameraControl *control, GstCameraControlExifInfo *info);
415 gboolean (*get_basic_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
416 gboolean (*get_misc_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
417 gboolean (*get_extra_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
418 void (*set_capture_command) (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
419 void (*set_record_command) (GstCameraControl *control, GstCameraControlRecordCommand cmd);
420 gboolean (*start_face_zoom) (GstCameraControl *control, gint x, gint y, gint zoom_level);
421 gboolean (*stop_face_zoom) (GstCameraControl *control);
422 gboolean (*set_ae_lock) (GstCameraControl *control, gboolean lock);
423 gboolean (*get_ae_lock) (GstCameraControl *control, gboolean *lock);
424 gboolean (*set_awb_lock) (GstCameraControl *control, gboolean lock);
425 gboolean (*get_awb_lock) (GstCameraControl *control, gboolean *lock);
428 void (* value_changed) (GstCameraControl *control, GstCameraControlChannel *channel, gint value);
429 } GstCameraControlClass;
431 GType gst_camera_control_get_type(void);
433 /* virtual class function wrappers */
434 const GList* gst_camera_control_list_channels (GstCameraControl *control);
436 gboolean gst_camera_control_set_value (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
437 gboolean gst_camera_control_get_value (GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value);
438 gboolean gst_camera_control_set_exposure (GstCameraControl *control, gint type, gint value1, gint value2);
439 gboolean gst_camera_control_get_exposure (GstCameraControl *control, gint type, gint *value1, gint *value2);
440 gboolean gst_camera_control_set_capture_mode (GstCameraControl *control, gint type, gint value);
441 gboolean gst_camera_control_get_capture_mode (GstCameraControl *control, gint type, gint *value);
442 gboolean gst_camera_control_set_strobe (GstCameraControl *control, gint type, gint value);
443 gboolean gst_camera_control_get_strobe (GstCameraControl *control, gint type, gint *value);
444 gboolean gst_camera_control_set_detect (GstCameraControl *control, gint type, gint value);
445 gboolean gst_camera_control_get_detect (GstCameraControl *control, gint type, gint *value);
446 gboolean gst_camera_control_set_zoom (GstCameraControl *control, gint type, gint value);
447 gboolean gst_camera_control_get_zoom (GstCameraControl *control, gint type, gint *value);
448 gboolean gst_camera_control_set_focus (GstCameraControl *control, gint mode, gint range);
449 gboolean gst_camera_control_get_focus (GstCameraControl *control, gint *mode, gint *range);
450 gboolean gst_camera_control_start_auto_focus (GstCameraControl *control);
451 gboolean gst_camera_control_stop_auto_focus (GstCameraControl *control);
452 gboolean gst_camera_control_set_focus_level (GstCameraControl *control, gint manual_level);
453 gboolean gst_camera_control_get_focus_level (GstCameraControl *control, gint *manual_level);
454 gboolean gst_camera_control_set_auto_focus_area (GstCameraControl *control, GstCameraControlRectType rect);
455 gboolean gst_camera_control_get_auto_focus_area (GstCameraControl *control, GstCameraControlRectType *rect);
456 gboolean gst_camera_control_set_wdr (GstCameraControl *control, gint value);
457 gboolean gst_camera_control_get_wdr (GstCameraControl *control, gint *value);
458 gboolean gst_camera_control_set_ahs (GstCameraControl *control, gint value);
459 gboolean gst_camera_control_get_ahs (GstCameraControl *control, gint *value);
460 gboolean gst_camera_control_set_part_color (GstCameraControl *control, gint type, gint value);
461 gboolean gst_camera_control_get_part_color (GstCameraControl *control, gint type, gint *value);
462 gboolean gst_camera_control_get_exif_info (GstCameraControl *control, GstCameraControlExifInfo *info);
463 gboolean gst_camera_control_get_basic_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
464 gboolean gst_camera_control_get_misc_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
465 gboolean gst_camera_control_get_extra_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
466 void gst_camera_control_set_capture_command (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
467 void gst_camera_control_set_record_command (GstCameraControl *control, GstCameraControlRecordCommand cmd);
468 gboolean gst_camera_control_start_face_zoom (GstCameraControl *control, gint x, gint y, gint zoom_level);
469 gboolean gst_camera_control_stop_face_zoom (GstCameraControl *control);
470 gboolean gst_camera_control_set_ae_lock (GstCameraControl *control, gboolean lock);
471 gboolean gst_camera_control_get_ae_lock (GstCameraControl *control, gboolean *lock);
472 gboolean gst_camera_control_set_awb_lock (GstCameraControl *control, gboolean lock);
473 gboolean gst_camera_control_get_awb_lock (GstCameraControl *control, gboolean *lock);
477 void gst_camera_control_value_changed (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
481 #endif /* __GST_CAMERA_CONTROL_H__ */