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/video/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 (G_TYPE_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 (G_TYPE_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;
69 /* enumerations for Camera control Exposure types */
72 GST_CAMERA_CONTROL_F_NUMBER,
73 GST_CAMERA_CONTROL_SHUTTER_SPEED,
74 GST_CAMERA_CONTROL_ISO,
75 GST_CAMERA_CONTROL_PROGRAM_MODE,
76 GST_CAMERA_CONTROL_EXPOSURE_MODE,
77 GST_CAMERA_CONTROL_EXPOSURE_VALUE
78 } GstCameraControlExposureType;
80 /* enumerations for Camera control Capture mode types */
83 GST_CAMERA_CONTROL_CAPTURE_MODE,
84 GST_CAMERA_CONTROL_OUTPUT_MODE,
85 GST_CAMERA_CONTROL_FRAME_COUNT,
86 GST_CAMERA_CONTROL_JPEG_QUALITY
87 } GstCameraControlCaptureModeType;
89 /* enumerations for Camera control Strobe types */
92 GST_CAMERA_CONTROL_STROBE_CONTROL,
93 GST_CAMERA_CONTROL_STROBE_CAPABILITIES,
94 GST_CAMERA_CONTROL_STROBE_MODE,
95 GST_CAMERA_CONTROL_STROBE_STATUS,
96 GST_CAMERA_CONTROL_STROBE_EV
97 } GstCameraControlStrobeType;
99 /* enumerations for Camera control Face detection types */
102 GST_CAMERA_CONTROL_FACE_DETECT_MODE,
103 GST_CAMERA_CONTROL_FACE_DETECT_NUMBER,
104 GST_CAMERA_CONTROL_FACE_FOCUS_SELECT,
105 GST_CAMERA_CONTROL_FACE_SELECT_NUMBER,
106 GST_CAMERA_CONTROL_FACE_DETECT_STATUS
107 } GstCameraControlFaceDetectType;
109 /* enumerations for Camera control Zoom types */
112 GST_CAMERA_CONTROL_DIGITAL_ZOOM,
113 GST_CAMERA_CONTROL_OPTICAL_ZOOM
114 } GstCameraControlZoomType;
116 /* enumerations for Camera control Part color */
119 GST_CAMERA_CONTROL_PART_COLOR_SRC,
120 GST_CAMERA_CONTROL_PART_COLOR_DST,
121 GST_CAMERA_CONTROL_PART_COLOR_MODE
122 } GstCameraControlPartColorType;
124 /* enumerations for Camera capture command */
127 GST_CAMERA_CONTROL_CAPTURE_COMMAND_NONE,
128 GST_CAMERA_CONTROL_CAPTURE_COMMAND_START,
129 GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP,
130 GST_CAMERA_CONTROL_CAPTURE_COMMAND_STOP_MULTISHOT
131 } GstCameraControlCaptureCommand;
133 /* enumerations for Camera record command */
136 GST_CAMERA_CONTROL_RECORD_COMMAND_NONE,
137 GST_CAMERA_CONTROL_RECORD_COMMAND_START,
138 GST_CAMERA_CONTROL_RECORD_COMMAND_STOP
139 } GstCameraControlRecordCommand;
141 /////////////////////////////////
142 // For Query functionalities //
143 // For Querying capabilities //
144 /////////////////////////////////
145 #define GST_CAMERA_CONTROL_MAX_NUM_FMT_DESC 32
146 #define GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION 32
147 #define GST_CAMERA_CONTROL_MAX_NUM_AVAILABLE_TPF 16
148 #define GST_CAMERA_CONTROL_MAX_NUM_AVAILABLE_FPS 16
149 #define GST_CAMERA_CONTROL_MAX_NUM_CTRL_LIST_INFO 64
150 #define GST_CAMERA_CONTROL_MAX_NUM_CTRL_MENU 64
151 #define GST_CAMERA_CONTROL_MAX_NUM_DETECTED_FACES 16
152 #define GST_CAMERA_CONTROL_MAX_SZ_CTRL_NAME_STRING 32
153 #define GST_CAMERA_CONTROL_MAX_SZ_DEV_NAME_STRING 32
155 /*! @struct GstCameraControlFracType
156 * @brief For timeperframe as fraction type
157 * Elapse time consumed by one frame, reverse of FPS
159 typedef struct _GstCameraControlFracType {
162 } GstCameraControlFracType;
164 /*! @struct GstCameraControlRectType
165 * @brief For touch auto focusing area and face detection area
167 typedef struct _GstCameraControlRectType {
172 } GstCameraControlRectType;
174 /*! @struct GstCameraControlResolutionType
175 * @brief For querying supported resolutions
177 typedef struct _GstCameraControlResolutionType {
181 /* Available time per frame(tpf) as each pixelformat */
183 GstCameraControlFracType tpf[GST_CAMERA_CONTROL_MAX_NUM_AVAILABLE_TPF];
184 } GstCameraControlResolutionType;
186 /*! @struct GstCameraControlFmtDescType
187 * @brief For querying supported format type
189 typedef struct _GstCameraControlFmtDescType {
190 /* fourcc name of each pixelformat */
194 /* Available resolutions as each pixelformat */
196 GstCameraControlResolutionType resolutions[GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION];
197 } GstCameraControlFmtDescType;
199 /*! @struct GstCameraControlCapsInfoType
200 * @brief For querying image input capabilities
202 typedef struct _GstCameraControlCapsInfoType {
203 char dev_name[GST_CAMERA_CONTROL_MAX_SZ_DEV_NAME_STRING];
206 GstCameraControlFmtDescType fmt_desc[GST_CAMERA_CONTROL_MAX_NUM_FMT_DESC];
208 int num_preview_resolution;
209 int preview_resolution_width[GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION];
210 int preview_resolution_height[GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION];
212 int num_capture_resolution;
213 int capture_resolution_width[GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION];
214 int capture_resolution_height[GST_CAMERA_CONTROL_MAX_NUM_RESOLUTION];
217 unsigned int preview_fmt[GST_CAMERA_CONTROL_MAX_NUM_FMT_DESC];
220 unsigned int capture_fmt[GST_CAMERA_CONTROL_MAX_NUM_FMT_DESC];
223 GstCameraControlFracType fps[GST_CAMERA_CONTROL_MAX_NUM_AVAILABLE_FPS];
224 } GstCameraControlCapsInfoType;
226 /*! @struct GstCameraControlFaceInfo
227 * @brief For face information
229 typedef struct _GstCameraControlFaceInfo {
232 GstCameraControlRectType rect;
233 } GstCameraControlFaceInfo;
235 /*! @struct GstCameraControlFaceDetectInfo
236 * @brief For face detect information
238 typedef struct _GstCameraControlFaceDetectInfo {
240 GstCameraControlFaceInfo face_info[GST_CAMERA_CONTROL_MAX_NUM_DETECTED_FACES];
241 } GstCameraControlFaceDetectInfo;
243 /////////////////////////////
244 // For Querying controls //
245 /////////////////////////////
247 GST_CAMERA_CTRL_TYPE_RANGE = 0,
248 GST_CAMERA_CTRL_TYPE_BOOL,
249 GST_CAMERA_CTRL_TYPE_ARRAY,
250 GST_CAMERA_CTRL_TYPE_UNKNOWN,
251 GST_CAMERA_CTRL_TYPE_NUM,
254 /*! @struct GstCameraControlCtrlMenuType
255 * @brief For querying menu of specified controls
257 typedef struct _GstCameraControlCtrlMenuType {
259 gchar menu_name[GST_CAMERA_CONTROL_MAX_SZ_CTRL_NAME_STRING];
260 } GstCameraControlCtrlMenuType;
262 /*! @struct GstCameraControlCtrlInfoType
263 * @brief For querying controls detail
265 typedef struct _GstCameraControlCtrlInfoType {
269 gchar ctrl_name[GST_CAMERA_CONTROL_MAX_SZ_CTRL_NAME_STRING];
275 GstCameraControlCtrlMenuType ctrl_menu[GST_CAMERA_CONTROL_MAX_NUM_CTRL_MENU];
276 } GstCameraControlCtrlInfoType;
278 /*! @struct GstCameraControlCtrlListInfoType
279 * @brief For querying controls
281 typedef struct _GstCameraControlCtrlListInfoType {
282 gint num_ctrl_list_info;
283 GstCameraControlCtrlInfoType ctrl_info[GST_CAMERA_CONTROL_MAX_NUM_CTRL_LIST_INFO];
284 } GstCameraControlCtrlListInfoType;
286 /* capabilities field */
287 #define GST_CAMERA_STROBE_CAP_NONE 0x0000 /* No strobe supported */
288 #define GST_CAMERA_STROBE_CAP_OFF 0x0001 /* Always flash off mode */
289 #define GST_CAMERA_STROBE_CAP_ON 0x0002 /* Always use flash light mode */
290 #define GST_CAMERA_STROBE_CAP_AUTO 0x0004 /* Flashlight works automatic */
291 #define GST_CAMERA_STROBE_CAP_REDEYE 0x0008 /* Red-eye reduction */
292 #define GST_CAMERA_STROBE_CAP_SLOWSYNC 0x0010 /* Slow sync */
293 #define GST_CAMERA_STROBE_CAP_FRONT_CURTAIN 0x0020 /* Front curtain */
294 #define GST_CAMERA_STROBE_CAP_REAR_CURTAIN 0x0040 /* Rear curtain */
295 #define GST_CAMERA_STROBE_CAP_PERMANENT 0x0080 /* keep turned on until turning off */
296 #define GST_CAMERA_STROBE_CAP_EXTERNAL 0x0100 /* use external strobe */
298 typedef struct _GstCameraControlExtraInfoType {
299 guint strobe_caps; /**< Use above caps field */
300 guint detection_caps; /**< Just boolean */
302 } GstCameraControlExtraInfoType;
303 /////////////////////////////////////
304 // END For Query functionalities //
305 /////////////////////////////////////
308 /* structure for Camera control EXIF information */
309 typedef struct _GstCameraControlExifInfo {
311 guint32 exposure_time_numerator; /* Exposure time, given in seconds */
312 guint32 exposure_time_denominator;
313 gint shutter_speed_numerator; /* Shutter speed, given in APEX(Additive System Photographic Exposure) */
314 gint shutter_speed_denominator;
315 gint brigtness_numerator; /* Value of brightness, before firing flash, given in APEX value */
316 gint brightness_denominator;
317 guint16 iso; /* Sensitivity value of sensor */
318 guint16 flash; /* Whether flash is fired(1) or not(0) */
319 gint metering_mode; /* metering mode in EXIF 2.2 */
320 gint exif_image_width; /* Size of image */
321 gint exif_image_height;
322 gint exposure_bias_in_APEX; /* Exposure bias in APEX standard */
323 gint software_used; /* Firmware S/W version */
326 gint component_configuration; /* color components arrangement */
327 gint colorspace; /* colorspace information */
328 gint focal_len_numerator; /* Lens focal length */
329 gint focal_len_denominator;
330 gint aperture_f_num_numerator; /* Aperture value */
331 gint aperture_f_num_denominator;
332 gint aperture_in_APEX; /* Aperture value in APEX standard */
333 gint max_lens_aperture_in_APEX; /* Max aperture value in APEX standard */
334 } GstCameraControlExifInfo;
336 /* structure for camera control class */
337 typedef struct _GstCameraControlClass {
338 GTypeInterface klass;
339 GstCameraControlType camera_control_type;
341 /* virtual functions */
342 const GList* (*list_channels) (GstCameraControl *control);
343 gboolean (*set_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
344 gboolean (*get_value) (GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value);
345 gboolean (*set_exposure) (GstCameraControl *control, gint type, gint value1, gint value2);
346 gboolean (*get_exposure) (GstCameraControl *control, gint type, gint *value1, gint *value2);
347 gboolean (*set_capture_mode) (GstCameraControl *control, gint type, gint value);
348 gboolean (*get_capture_mode) (GstCameraControl *control, gint type, gint *value);
349 gboolean (*set_strobe) (GstCameraControl *control, gint type, gint value);
350 gboolean (*get_strobe) (GstCameraControl *control, gint type, gint *value);
351 gboolean (*set_detect) (GstCameraControl *control, gint type, gint value);
352 gboolean (*get_detect) (GstCameraControl *control, gint type, gint *value);
353 gboolean (*set_zoom) (GstCameraControl *control, gint type, gint value);
354 gboolean (*get_zoom) (GstCameraControl *control, gint type, gint *value);
355 gboolean (*set_focus) (GstCameraControl *control, gint mode, gint range);
356 gboolean (*get_focus) (GstCameraControl *control, gint *mode, gint *range);
357 gboolean (*start_auto_focus) (GstCameraControl *control);
358 gboolean (*stop_auto_focus) (GstCameraControl *control);
359 gboolean (*set_focus_level) (GstCameraControl *control, gint manual_level);
360 gboolean (*get_focus_level) (GstCameraControl *control, gint *manual_level);
361 gboolean (*set_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType rect);
362 gboolean (*get_auto_focus_area) (GstCameraControl *control, GstCameraControlRectType *rect);
363 gboolean (*set_wdr) (GstCameraControl *control, gint value);
364 gboolean (*get_wdr) (GstCameraControl *control, gint *value);
365 gboolean (*set_ahs) (GstCameraControl *control, gint value);
366 gboolean (*get_ahs) (GstCameraControl *control, gint *value);
367 gboolean (*set_part_color) (GstCameraControl *control, gint type, gint value);
368 gboolean (*get_part_color) (GstCameraControl *control, gint type, gint *value);
369 gboolean (*get_exif_info) (GstCameraControl *control, GstCameraControlExifInfo *info);
370 gboolean (*get_basic_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
371 gboolean (*get_misc_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
372 gboolean (*get_extra_dev_info) (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
373 void (*set_capture_command) (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
374 void (*set_record_command) (GstCameraControl *control, GstCameraControlRecordCommand cmd);
375 gboolean (*start_face_zoom) (GstCameraControl *control, gint x, gint y, gint zoom_level);
376 gboolean (*stop_face_zoom) (GstCameraControl *control);
377 gboolean (*set_ae_lock) (GstCameraControl *control, gboolean lock);
378 gboolean (*get_ae_lock) (GstCameraControl *control, gboolean *lock);
379 gboolean (*set_awb_lock) (GstCameraControl *control, gboolean lock);
380 gboolean (*get_awb_lock) (GstCameraControl *control, gboolean *lock);
381 gboolean (*set_user_buffer_fd) (GstCameraControl *control, int *tfd, int count);
384 void (* value_changed) (GstCameraControl *control, GstCameraControlChannel *channel, gint value);
385 } GstCameraControlClass;
387 GType gst_camera_control_get_type(void);
390 const GList* gst_camera_control_list_channels (GstCameraControl *control);
391 gboolean gst_camera_control_set_value (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
392 gboolean gst_camera_control_get_value (GstCameraControl *control, GstCameraControlChannel *control_channel, gint *value);
393 gboolean gst_camera_control_set_exposure (GstCameraControl *control, gint type, gint value1, gint value2);
394 gboolean gst_camera_control_get_exposure (GstCameraControl *control, gint type, gint *value1, gint *value2);
395 gboolean gst_camera_control_set_capture_mode (GstCameraControl *control, gint type, gint value);
396 gboolean gst_camera_control_get_capture_mode (GstCameraControl *control, gint type, gint *value);
397 gboolean gst_camera_control_set_strobe (GstCameraControl *control, gint type, gint value);
398 gboolean gst_camera_control_get_strobe (GstCameraControl *control, gint type, gint *value);
399 gboolean gst_camera_control_set_detect (GstCameraControl *control, gint type, gint value);
400 gboolean gst_camera_control_get_detect (GstCameraControl *control, gint type, gint *value);
401 gboolean gst_camera_control_set_zoom (GstCameraControl *control, gint type, gint value);
402 gboolean gst_camera_control_get_zoom (GstCameraControl *control, gint type, gint *value);
403 gboolean gst_camera_control_set_focus (GstCameraControl *control, gint mode, gint range);
404 gboolean gst_camera_control_get_focus (GstCameraControl *control, gint *mode, gint *range);
405 gboolean gst_camera_control_start_auto_focus (GstCameraControl *control);
406 gboolean gst_camera_control_stop_auto_focus (GstCameraControl *control);
407 gboolean gst_camera_control_set_focus_level (GstCameraControl *control, gint manual_level);
408 gboolean gst_camera_control_get_focus_level (GstCameraControl *control, gint *manual_level);
409 gboolean gst_camera_control_set_auto_focus_area (GstCameraControl *control, GstCameraControlRectType rect);
410 gboolean gst_camera_control_get_auto_focus_area (GstCameraControl *control, GstCameraControlRectType *rect);
411 gboolean gst_camera_control_set_wdr (GstCameraControl *control, gint value);
412 gboolean gst_camera_control_get_wdr (GstCameraControl *control, gint *value);
413 gboolean gst_camera_control_set_ahs (GstCameraControl *control, gint value);
414 gboolean gst_camera_control_get_ahs (GstCameraControl *control, gint *value);
415 gboolean gst_camera_control_set_part_color (GstCameraControl *control, gint type, gint value);
416 gboolean gst_camera_control_get_part_color (GstCameraControl *control, gint type, gint *value);
417 gboolean gst_camera_control_get_exif_info (GstCameraControl *control, GstCameraControlExifInfo *info);
418 gboolean gst_camera_control_get_basic_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCapsInfoType *info);
419 gboolean gst_camera_control_get_misc_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlCtrlListInfoType *info);
420 gboolean gst_camera_control_get_extra_dev_info (GstCameraControl *control, gint dev_id, GstCameraControlExtraInfoType *info);
421 void gst_camera_control_set_capture_command (GstCameraControl *control, GstCameraControlCaptureCommand cmd);
422 void gst_camera_control_set_record_command (GstCameraControl *control, GstCameraControlRecordCommand cmd);
423 gboolean gst_camera_control_start_face_zoom (GstCameraControl *control, gint x, gint y, gint zoom_level);
424 gboolean gst_camera_control_stop_face_zoom (GstCameraControl *control);
425 gboolean gst_camera_control_set_ae_lock (GstCameraControl *control, gboolean lock);
426 gboolean gst_camera_control_get_ae_lock (GstCameraControl *control, gboolean *lock);
427 gboolean gst_camera_control_set_awb_lock (GstCameraControl *control, gboolean lock);
428 gboolean gst_camera_control_get_awb_lock (GstCameraControl *control, gboolean *lock);
429 gboolean gst_camera_control_set_user_buffer_fd (GstCameraControl *control, int *tfd, int count);
433 void gst_camera_control_value_changed (GstCameraControl *control, GstCameraControlChannel *control_channel, gint value);
437 #endif /* __GST_CAMERA_CONTROL_H__ */