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 #ifndef __CAMERASRC_H__
25 #define __CAMERASRC_H__
27 #include <stdint.h> /* to use uint64_t */
28 #include <camerasrc-error.h>
34 /* GENERAL DEFINITIONS */
36 * Type definition of av camera src handle.
38 typedef void *camsrc_handle_t;
41 /* ENUMERATION DEFINITIONS */
42 /*! @enum camerasrc_state_t
43 * @brief Enumeration type for state transition
46 CAMERASRC_STATE_NONE = 0,
47 CAMERASRC_STATE_CREATED,
48 CAMERASRC_STATE_REALIZED,
49 CAMERASRC_STATE_READY,
50 CAMERASRC_STATE_PREVIEW,
51 CAMERASRC_STATE_STILL,
52 CAMERASRC_STATE_VIDEO,
53 CAMERASRC_STATE_UNREALIZED,
54 CAMERASRC_STATE_DESTROYED,
55 CAMERASRC_STATE_AF_IN_PROGRESS,
58 /*! @enum camerasrc_dev_id_t
59 * @brief Enumeration type for camera device ID
61 * Devices will be managed by this IDs. (Independent with device index of V4L2)
64 CAMERASRC_DEV_ID_PRIMARY, /**< Higher resolution camera*/
65 CAMERASRC_DEV_ID_SECONDARY, /**< Lower resolution camera*/
66 CAMERASRC_DEV_ID_EXTENSION, /**< reserved for extension*/
67 CAMERASRC_DEV_ID_UNKNOWN, /**< reserved for extension*/
68 CAMERASRC_DEV_ID_NUM, /**< Number of IDs*/
72 CAMERASRC_COLOR_VIOLET = 0,
73 CAMERASRC_COLOR_PURPLE,
74 CAMERASRC_COLOR_MAGENTA_1,
75 CAMERASRC_COLOR_MAGENTA_2,
76 CAMERASRC_COLOR_RED_1,
77 CAMERASRC_COLOR_RED_2,
78 CAMERASRC_COLOR_BROWN,
79 CAMERASRC_COLOR_YELLOW,
80 CAMERASRC_COLOR_GREEN_1,
81 CAMERASRC_COLOR_GREEN_2,
82 CAMERASRC_COLOR_GREEN_3,
83 CAMERASRC_COLOR_GREEN_4,
84 CAMERASRC_COLOR_COBALT_BLUE,
86 CAMERASRC_COLOR_BLUE_1,
87 CAMERASRC_COLOR_BLUE_2,
93 CAMERASRC_PARTCOLOR_MODE_NONE = 0,
94 CAMERASRC_PARTCOLOR_MODE_SWAP,
95 CAMERASRC_PARTCOLOR_MODE_ACCENT,
96 CAMERASRC_PARTCOLOR_MODE_NUM,
97 }camerasrc_partcolor_mode_t;
99 /*! @enum camerasrc_ctrl_t
100 * @brief Enumeration type for camera controls
102 * Special control entries for camera effects
104 * @remark Strobo can be controlled by this entry and ::camerasrc_set_strobo_status
107 CAMERASRC_CTRL_BRIGHTNESS = 0, /**< Brightness control entry*/
108 CAMERASRC_CTRL_CONTRAST, /**< Contrast control entry*/
109 CAMERASRC_CTRL_DIGITAL_ZOOM, /**< Digital zoom control entry*/
110 CAMERASRC_CTRL_OPTICAL_ZOOM, /**< Optical zoom control entry*/
111 CAMERASRC_CTRL_WHITE_BALANCE, /**< White balance control entry*/
112 CAMERASRC_CTRL_COLOR_TONE, /**< Color tone control entry*/
113 CAMERASRC_CTRL_PROGRAM_MODE, /**< Program mode control entry*/
114 CAMERASRC_CTRL_FLIP, /**< Flip control entry*/
115 CAMERASRC_CTRL_PARTCOLOR_SRC, /**< Partcolor effect source */
116 CAMERASRC_CTRL_PARTCOLOR_DST, /**< Partcolor effect destination */
117 CAMERASRC_CTRL_PARTCOLOR_MODE, /**< Partcolor effect mode */
118 CAMERASRC_CTRL_ANTI_HANDSHAKE, /**< Anti-handshake control, 0:OFF / 1:ON / 2:AUTO / 3:MOVIE */
119 CAMERASRC_CTRL_WIDE_DYNAMIC_RANGE, /**< wide dynamic control, 0:OFF / 1:ON / 2:AUTO */
120 CAMERASRC_CTRL_SATURATION, /**< Saturation value control */
121 CAMERASRC_CTRL_SHARPNESS, /**< Sharpness value control */
122 CAMERASRC_CTRL_ISO, /**< Sensor sensitivity*/
123 CAMERASRC_CTRL_PHOTOMETRY, /**< Exposure mode*/
124 CAMERASRC_CTRL_NUM, /**< Number of Controls*/
127 /*! @enum camerasrc_af_mode_t
128 * @brief AF operation mode
131 CAMERASRC_AF_MODE_AUTO = 0, /**< Auto Focus */
132 CAMERASRC_AF_MODE_MANUAL, /**< Manual Focus */
133 CAMERASRC_AF_MODE_PAN, /**< Pan Focus */
134 CAMERASRC_AF_MODE_TOUCH_AUTO, /**< Touch Auto Focus */
135 CAMERASRC_AF_MODE_CONTINUOUS, /**< Continuous Focus */
136 CAMERASRC_AF_MODE_NUM, /**< Number of AF modes */
137 }camerasrc_af_mode_t;
139 /*! @enum camerasrc_af_scan_range_t
140 * @brief AF scan range
144 CAMERASRC_AF_RANGE_NORMAL = 0, /**< Scan autofocus in normal range */
145 CAMERASRC_AF_RANGE_MACRO, /**< Scan autofocus in macro range(close distance) */
146 CAMERASRC_AF_RANGE_FULL, /**< Scan autofocus in full range(all range scan, limited by dev spec) */
147 CAMERASRC_AF_RANGE_NUM, /**< Number of AF range types */
148 }camerasrc_af_scan_range_t;
150 /*! @enum camerasrc_resol_name_t
151 * @brief Enumeration type of resolution settings based on traditional resolution name
152 * Means pixel order of contents.
153 * @remark In the Grandprix, only YUV422P & RGGB8 is used
156 CAMERASRC_RESOL_QQCIF = 0, /**< 88 x 72 */
157 CAMERASRC_RESOL_QQVGA, /**< 160 x 120 */
158 CAMERASRC_RESOL_QCIF, /**< 176 x 144 */
159 CAMERASRC_RESOL_QVGA, /**< 320 x 240 */
160 CAMERASRC_RESOL_CIF, /**< 352 x 288 */
161 CAMERASRC_RESOL_VGA, /**< 640 x 480 */
162 CAMERASRC_RESOL_WVGA, /**< 800 x 480 */
163 CAMERASRC_RESOL_SVGA, /**< 800 x 600 */
164 CAMERASRC_RESOL_WSXGA, /**< 1280 x 960 (1M) */
165 CAMERASRC_RESOL_UXGA, /**< 1600 x 1200 (2M) */
166 CAMERASRC_RESOL_QXGA, /**< 2048 x 1536 (3M) */
167 CAMERASRC_RESOL_WQSXGA, /**< 2560 x 1920 (5M) */
168 CAMERASRC_RESOL_720P, /**< 1280 x 720 (720P) */
169 CAMERASRC_RESOL_WQVGA, /**< 400 x 240 */
170 CAMERASRC_RESOL_RQVGA, /**< 240 x 320 */
171 CAMERASRC_RESOL_RWQVGA, /**< 240 x 400 */
172 CAMERASRC_RESOL_QVGA_60FPS, /**< 320 x 240 60FPS(Slow motion I) */
173 CAMERASRC_RESOL_QVGA_120FPS, /**< 320 x 240 60FPS(Slow motion II) */
175 }camerasrc_resol_name_t;
177 /*! @enum camerasrc_pix_format_t
178 * @brief Means order of pixel of contents
179 * Means pixel order of contents.
180 * @remark In the Grandprix, only YUV422P & RGGB8 is used
183 CAMERASRC_PIX_NONE = -1, /**< Default value or Not supported */
184 CAMERASRC_PIX_YUV422P = 0, /**< Pixel format like YYYYYYYYUUUUVVVV*/
185 CAMERASRC_PIX_YUV420P, /**< Pixel format like YYYYYYYYUUVV*/
186 CAMERASRC_PIX_YUV420, /**< Pixel format like YYYYYYYYUVUV*/
187 CAMERASRC_PIX_SN12, /**< YUV420 (interleaved, non-linear) */
188 CAMERASRC_PIX_ST12, /**< YUV420 (interleaved, tiled, non-linear) */
189 CAMERASRC_PIX_YUY2, /**< YUV 4:2:2 as for UYVY but with different component ordering within the u_int32 macropixel */
190 CAMERASRC_PIX_RGGB8, /**< Raw RGB Pixel format like CCD order, a pixel consists of 8 bits, Actually means JPEG + JPEG image output */
191 CAMERASRC_PIX_RGGB10, /**< Raw RGB Pixel format like CCD order, a pixel consists of 10 bits, Actually means JPEG + YUV image output */
192 CAMERASRC_PIX_RGB565, /**< Raw RGB Pixel format like CCD order, a pixel consists of 10 bits, Actually means JPEG + YUV image output */
193 CAMERASRC_PIX_UYVY, /**< YUV 4:2:2 */
194 CAMERASRC_PIX_NV12, /**< YUV 4:2:0, 8-bit Y plane followed by an interleaved U/V plane with 2x2 subsampling */
195 CAMERASRC_PIX_INTERLEAVED, /**< JPEG/YUYV interleaved data format for zero shutter lag */
196 CAMERASRC_PIX_NUM, /**< Number of pixel formats*/
197 }camerasrc_pix_format_t;
199 /*! @enum camerasrc_colorspace_t
200 * @brief Means stored order or compressed status of image.
201 * Means stored order or compressed status of image. supplements of camerasrc_pix_format_t
203 * @note RAW means RGB/YUV pixel data, JPEG means compressed JPG file with marker information(header)
206 CAMERASRC_COL_NONE = -1, /**< Default value or Not supported */
207 CAMERASRC_COL_RAW, /**< Non-compressed RGB/YUV pixel data*/
208 CAMERASRC_COL_JPEG, /**< Compressed jpg data*/
209 CAMERASRC_COL_NUM, /**< Number of colorspace data*/
210 }camerasrc_colorspace_t;
212 /*! @enum camerasrc_auto_focus_status_t
217 CAMERASRC_AUTO_FOCUS_STATUS_RELEASED, /**< AF status released.*/
218 CAMERASRC_AUTO_FOCUS_STATUS_ONGOING, /**< AF in progress*/
219 CAMERASRC_AUTO_FOCUS_STATUS_NUM, /**< Number of AF status*/
220 }camerasrc_auto_focus_status_t;
222 /*! @enum camerasrc_auto_focus_cmd_t
227 CAMERASRC_AUTO_FOCUS_CMD_NULL, /**< Null command.*/
228 CAMERASRC_AUTO_FOCUS_CMD_START, /**< Start AF.*/
229 CAMERASRC_AUTO_FOCUS_CMD_STOP, /**< Stop AF.*/
230 CAMERASRC_AUTO_FOCUS_CMD_KILL, /**< Kill AF thread.*/
231 CAMERASRC_AUTO_FOCUS_CMD_NUM, /**< Number of AF command*/
232 }camerasrc_auto_focus_cmd_t;
234 /*! @enum camerasrc_auto_focus_result_t
239 CAMERASRC_AUTO_FOCUS_RESULT_FOCUSED = 2, /**< Focused.*/
240 CAMERASRC_AUTO_FOCUS_RESULT_FAILED, /**< AF failed.*/
241 CAMERASRC_AUTO_FOCUS_RESULT_NUM, /**< Number of AF result*/
242 }camerasrc_auto_focus_result_t;
244 /*! @enum camerasrc_ae_lock_t
248 CAMERASRC_AE_LOCK = 0,
251 }camerasrc_ae_lock_t;
253 /*! @enum camerasrc_io_method_t
257 CAMERASRC_IO_METHOD_READ= 0,
258 CAMERASRC_IO_METHOD_MMAP,
259 CAMERASRC_IO_METHOD_USRPTR,
260 CAMERASRC_IO_METHOD_NUM,
261 }camerasrc_io_method_t;
263 /*! @enum camerasrc_buffer_queued_status
267 CAMERASRC_BUFFER_QUEUED = 0,
268 CAMERASRC_BUFFER_DEQUEUED = 1,
269 }camerasrc_buffer_queued_status;
272 /* STRUCTURE DEFINITIONS */
274 typedef struct _camerasrc_rect_t {
281 /*! @struct camsrc_frac_t
282 * @brief Time per frame or frame per second will be expressed by this structure
283 * Time per frame or frame per second will be expressed by this structure
285 typedef struct _camerasrc_frac_t {
286 int numerator; /**< Upper number of fraction*/
287 int denominator; /**< Lower number of fraction*/
290 /*! @struct camerasrc_buffer_t
294 typedef struct _camerasrc_buffer_t {
295 unsigned int length; /**< Size of stored data*/
296 unsigned char* start; /**< Start address of data*/
297 camerasrc_buffer_queued_status queued_status; /**< Queued or Dequeued status */
298 } camerasrc_buffer_t;
300 /*! @struct camerasrc_usr_buf_t
301 * @brief data buffer set to present usrptr buffer to camsrctem
302 * Image data buffer set
305 camerasrc_buffer_t* present_buffer;
306 unsigned int num_buffer;
307 } camerasrc_usr_buf_t;
309 /*! @struct camerasrc_dimension_t
310 * @brief For non-regular size resolution
311 * width and height can be set independently
313 typedef struct _camerasrc_dimension_t {
316 } camerasrc_dimension_t;
318 /*! @union camerasrc_size_t
319 * @brief Size can be expressed by resolution name(predefined) and dimension(x, y)
321 typedef union _camerasrc_size_t {
322 camerasrc_resol_name_t res; /**< Predefined resolution name */
323 camerasrc_dimension_t dim; /**< Dimensional expression */
326 /*! @struct camerasrc_format_t
327 * @brief Format description structure
328 * in/output format description structure just like v4l2_format
330 typedef struct _camerasrc_format_t {
331 camerasrc_size_t img_size;
332 camerasrc_size_t thumb_size; /**< Thumbnail size. Only effective with CAMERASRC_PIX_RGGB8 or CAMERASRC_PIX_RGGB10 */
333 camerasrc_pix_format_t pix_format; /**< pixel order format*/
334 int num_planes; /**< bytes per a line*/
335 int bytesperline; /**< bytes per a line*/
336 int sizeimage; /**< size of whole image*/
337 camerasrc_colorspace_t colorspace; /**< stored status of image*/
338 unsigned int quality; /**< jpeg compress ratio*/
339 unsigned int is_highquality_mode; /**< picture quality is high or normal */
340 int rotation; /**< Rotation angle of camera input */
341 } camerasrc_format_t;
343 typedef struct _camerasrc_ctrl_query_t {
344 int support; /**<1: support, 0: Not support, -1: extra support(Non v4l2)*/
345 int max; /**<Integer max value(includes enums)*/
346 int min; /**<Integer min value(includes enums)*/
347 }camerasrc_ctrl_query_t;
349 typedef struct _camerasrc_exif_t {
351 unsigned int exposure_time_numerator; /**< Exposure time, given in seconds */
352 unsigned int exposure_time_denominator;
353 int shutter_speed_numerator; /**< Shutter speed, given in APEX(Additive System Photographic Exposure) */
354 int shutter_speed_denominator;
355 int brigtness_numerator; /**< Value of brightness, before firing flash, given in APEX value */
356 int brightness_denominator;
357 unsigned short int iso; /**< Sensitivity value of sensor */
358 unsigned short int flash; /**< Whether flash is fired(1) or not(0) */
359 int metering_mode; /**< metering mode in EXIF 2.2 */
360 int exif_image_width; /**< Size of image */
361 int exif_image_height;
362 int exposure_bias_in_APEX; /**< Exposure bias in APEX standard */
363 int software_used; /**< Firmware S/W version */
364 int focal_len_numerator; /**< Lens focal length (f = 4.5mm) */
365 int focal_len_denominator;
366 int aperture_f_num_numerator; /**< Aperture value (f_num = 2.8) */
367 int aperture_f_num_denominator;
368 int aperture_in_APEX; /**< Aperture value in APEX standard */
369 int max_lens_aperture_in_APEX; /**< Max aperture value in APEX standard */
372 int component_configuration; /**< color components arrangement (YCbCr = 1230) */
373 int colorspace; /**< colorspace information (sRGB=1) */
376 typedef struct _camerasrc_frame_data_t {
378 unsigned int phyAddrY;
379 unsigned int phyAddrCbCr;
380 unsigned int virAddrY;
381 unsigned int virAddrCbCr;
382 }camerasrc_frame_data_t;
384 /* JPEG/YUV interleaved data */
385 #define INTERLEAVED_JPEG_MAX_SIZE (1024*1024*6) /* 6 Mbyte */
387 /* Fixed focal length and aperture f-number */
388 #define CAMERASRC_PRIMARY_FOCAL_LEGNTH_NUM 397
389 #define CAMERASRC_PRIMARY_FOCAL_LEGNTH_DENOM 100
390 #define CAMERASRC_PRIMARY_F_NUMBER_NUM 265
391 #define CAMERASRC_PRIMARY_F_NUMBER_DENOM 100
392 #define CAMERASRC_SECONDARY_FOCAL_LEGNTH_NUM 273
393 #define CAMERASRC_SECONDARY_FOCAL_LEGNTH_DENOM 100
394 #define CAMERASRC_SECONDARY_F_NUMBER_NUM 28
395 #define CAMERASRC_SECONDARY_F_NUMBER_DENOM 10
397 /* For Query functionalities
398 For Querying capabilities */
399 /*! Use static size of structures for querying because of performance
402 #define MAX_NUM_FMT_DESC 32
403 #define MAX_NUM_RESOLUTION 32
404 #define MAX_NUM_AVAILABLE_TPF 16
405 #define MAX_NUM_AVAILABLE_FPS 16
406 #define MAX_NUM_CTRL_LIST_INFO 64
407 #define MAX_NUM_CTRL_MENU 64
408 #define MAX_SZ_CTRL_NAME_STRING 32
409 #define MAX_SZ_DEV_NAME_STRING 32
412 CAMERASRC_FCC_USE_NONE = 0x00000001,
413 CAMERASRC_FCC_USE_REC_PREVIEW = 0x00000010,
414 CAMERASRC_FCC_USE_CAP_PREVIEW = 0x00000100,
415 CAMERASRC_FCC_USE_RECORDING = 0x00001000,
416 CAMERASRC_FCC_USE_NORMAL_CAPTURE = 0x00010000,
417 CAMERASRC_FCC_USE_CONT_CAPTURE = 0x00100000,
418 CAMERASRC_FCC_USE_NUM = 6,
421 /*! @struct camerasrc_tpf_frac_t
422 * @brief For timeperframe as fraction type
423 * Elapse time consumed by one frame, reverse of FPS
428 }camerasrc_tpf_frac_t;
430 /*! @struct camerasrc_resolution_t
431 * @brief For querying supported resolutions
437 /* Available time per frame(tpf) as each pixelformat */
439 camerasrc_tpf_frac_t tpf[MAX_NUM_AVAILABLE_TPF];
440 } camerasrc_resolution_t;
442 /*! @struct camerasrc_fmt_desc_t
443 * @brief For querying supported format type
446 /* fourcc name of each pixelformat */
450 /* Available resolutions as each pixelformat */
452 camerasrc_resolution_t resolutions[MAX_NUM_RESOLUTION];
453 } camerasrc_fmt_desc_t;
455 /*! @struct camerasrc_caps_info_t
456 * @brief For querying image input capabilities
459 char dev_name[MAX_SZ_DEV_NAME_STRING];
460 camerasrc_dev_id_t input_id;
462 camerasrc_fmt_desc_t fmt_desc[MAX_NUM_FMT_DESC];
464 int num_preview_resolution;
465 int preview_resolution_width[MAX_NUM_RESOLUTION];
466 int preview_resolution_height[MAX_NUM_RESOLUTION];
468 int num_capture_resolution;
469 int capture_resolution_width[MAX_NUM_RESOLUTION];
470 int capture_resolution_height[MAX_NUM_RESOLUTION];
473 unsigned int preview_fmt[MAX_NUM_FMT_DESC];
476 unsigned int capture_fmt[MAX_NUM_FMT_DESC];
479 camerasrc_frac_t fps[MAX_NUM_AVAILABLE_FPS];
480 } camerasrc_caps_info_t;
482 /* For Querying controls */
484 CTRL_TYPE_RANGE = 0, /**< Integer, range type */
485 CTRL_TYPE_BOOL, /**< Boolean type, 1 equals positive and 0 is negative */
486 CTRL_TYPE_ARRAY, /**< Array type, also called menu type. each integer(enumeration) value can be set */
487 CTRL_TYPE_UNKNOWN, /**< Unknown type, for error control */
491 /*! @struct camerasrc_ctrl_menu_t
492 * @brief For querying menu of specified controls
495 int menu_index; /**< What number is used for accessing this menu */
496 char menu_name[MAX_SZ_CTRL_NAME_STRING]; /**< name of each menu */
497 }camerasrc_ctrl_menu_t;
499 /*! @struct camerasrc_ctrl_info_t
500 * @brief For querying controls detail
503 camerasrc_ctrl_t camsrc_ctrl_id; /**< camsrc camera control ID for controlling this */
504 int v4l2_ctrl_id; /**< v4l2 ctrl id, user not need to use this. see @struct camerasrc_ctrl_t */
505 int ctrl_type; /**< Type of this control */
506 char ctrl_name[MAX_SZ_CTRL_NAME_STRING]; /**< Name of this control */
507 int min; /**< minimum value */
508 int max; /**< maximum value */
509 int step; /**< unit of the values */
510 int default_val; /**< Default value of the array or range */
511 int num_ctrl_menu; /**< In the case of array type control, number of supported menu information */
512 camerasrc_ctrl_menu_t ctrl_menu[MAX_NUM_CTRL_MENU]; /**< @struct camerasrc_ctrl_menu_t for detailed each menu information*/
513 } camerasrc_ctrl_info_t;
515 /*! @struct camerasrc_ctrl_list_info_t
516 * @brief For querying controls
519 int num_ctrl_list_info; /**< Number of supported controls */
520 camerasrc_ctrl_info_t ctrl_info[MAX_NUM_CTRL_LIST_INFO]; /**< @struct camerasrc_ctrl_info_t for each control information */
521 } camerasrc_ctrl_list_info_t;
524 /* capabilities field */
525 #define CAMERASRC_STROBE_CAP_NONE 0x0000 /* No strobe supported */
526 #define CAMERASRC_STROBE_CAP_OFF 0x0001 /* Always flash off mode */
527 #define CAMERASRC_STROBE_CAP_ON 0x0002 /* Always use flash light mode */
528 #define CAMERASRC_STROBE_CAP_AUTO 0x0004 /* Flashlight works automatic */
529 #define CAMERASRC_STROBE_CAP_REDEYE 0x0008 /* Red-eye reduction */
530 #define CAMERASRC_STROBE_CAP_SLOWSYNC 0x0010 /* Slow sync */
531 #define CAMERASRC_STROBE_CAP_FRONT_CURTAIN 0x0020 /* Front curtain */
532 #define CAMERASRC_STROBE_CAP_REAR_CURTAIN 0x0040 /* Rear curtain */
533 #define CAMERASRC_STROBE_CAP_PERMANENT 0x0080 /* keep turned on until turning off */
534 #define CAMERASRC_STROBE_CAP_EXTERNAL 0x0100 /* use external strobe */
536 typedef struct _camerasrc_extra_info_t{
537 unsigned int strobe_caps; /**< Use above caps field */
538 unsigned int detection_caps; /**< Just boolean */
539 unsigned int reserved[4];
540 } camerasrc_extra_info_t;
541 /* END For Query functionalities */
543 /*! @def CAMERASRC_SET_SIZE_BY_DIMENSION
544 * @brief Utility definitions for setting non-regular size
546 #define CAMERASRC_SET_SIZE_BY_DIMENSION(format, img_width, img_height) { \
547 format.img_size.dim.width = img_width; \
548 format.img_size.dim.height = img_height; \
552 /* CALLBACK DEFINITIONS */
553 /*! @typedef camerasrc_callback_t
554 * @brief Called back when auto-focusing returns
555 * This callback will be called when the lens properly auto-focused
557 typedef int (*camerasrc_callback_t) (camsrc_handle_t handle, int state, void* usr_data);
559 /* Static variables */
561 * Label for camera control. This static variable has a label for each of camerasrc_ctrl_t enumeration.
562 * When enumeration of camerasrc_ctrl_t is increased, this variable should be increased, too.
563 * This string could be used as a key by user.
564 * Reference : camerasrc_ctrl_t, _camerasrc_ctrl_list
567 static char *camerasrc_ctrl_label[CAMERASRC_CTRL_NUM] =
569 "brightness", /**< label for CAMERASRC_CTRL_BRIGHTNESS */
570 "contrast", /**< label for CAMERASRC_CTRL_CONTRAST */
571 "digital zoom", /**< label for CAMERASRC_CTRL_DIGITAL_ZOOM */
572 "optical zoom", /**< label for CAMERASRC_CTRL_OPTICAL_ZOOM */
573 "white balance", /**< label for CAMERASRC_CTRL_WHITE_BALANCE */
574 "color tone", /**< label for CAMERASRC_CTRL_COLOR_TONE */
575 "program mode", /**< label for CAMERASRC_CTRL_PROGRAM_MODE */
576 "flip", /**< label for CAMERASRC_CTRL_FLIP */
577 "partcolor src", /**< label for CAMERASRC_CTRL_PARTCOLOR_SRC */
578 "partcolor dst", /**< label for CAMERASRC_CTRL_PARTCOLOR_DST */
579 "partcolor mode", /**< label for CAMERASRC_CTRL_PARTCOLOR_MODE */
580 "anti handshake", /**< label for CAMERASRC_CTRL_ANTI_HANDSHAKE */
581 "wide dynamic range", /**< label for CAMERASRC_CTRL_WIDE_DYNAMIC_RANGE */
582 "saturation", /**< label for CAMERASRC_CTRL_SATURATION */
583 "sharpness", /**< label for CAMERASRC_CTRL_SHARPNESS */
584 "iso", /**< label for CAMERASRC_CTRL_ISO */
585 "photometry", /**< label for CAMERASRC_CTRL_PHOTOMETRY */
588 /* FUNCTION DEFINITIONS */
590 /**** M A I N O P E R A T I O N ****/
593 * allocate the handle, set initial state & settings
595 * @param[in] phandle ::camsrc_handle_t camerasrc context handle to be created
596 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
597 * @see camerasrc_destroy
598 * @note State transition : [CAMERASRC_STATE_NONE] => [CAMERASRC_STATE_CREATED]
599 * Phase description : Non-running phase
601 int camerasrc_create(camsrc_handle_t *phandle);
604 * proceed fd close, other finalization routines
606 * @param[in] handle ::camsrc_handle_t camerasrc context handle
608 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
610 * @see <camerasrc_create>
612 * @note State transition : [CAMERASRC_STATE_UNREALIZED] => [CAMERASRC_STATE_DESTROYED]
613 * Phase description : Non-running phase
615 int camerasrc_destroy(camsrc_handle_t handle);
618 * free device context handle, other finalization routines
620 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
621 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
622 * @see camerasrc_create
623 * @note State transition : [CAMERASRC_STATE_UNREALIZED] => [CAMERASRC_STATE_DESTROYED]
624 * Phase description : Non-running phase
626 int camerasrc_close_device(camsrc_handle_t handle);
629 * Get the state of camerasrc context handle
631 * @param[in] handle ::camsrc_handle_t camerasrc context handle
632 * @param[out] state ::camerasrc_state_t camerasrc context current state
633 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t code
636 int camerasrc_get_state(camsrc_handle_t handle, camerasrc_state_t* state);
639 * Allocate the device context handle, open device node and do the miscellaneous settings
641 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
642 * @return Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
643 * @see camerasrc_unrealize
644 * @note State transition : [CAMERASRC_STATE_CREATED] => [CAMERASRC_STATE_REALIZED]
645 * Phase description : Non-running phase
646 * device name can be dependent on kernel module
648 int camerasrc_realize(camsrc_handle_t handle);
651 * Deallocate the device structure of buffers, close device
653 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
654 * @return Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
655 * @see camerasrc_realize
656 * @note State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_UNREALIZED]
657 * Phase description : Transit to Non-running phase
659 int camerasrc_unrealize(camsrc_handle_t handle);
662 * Prepare Handle to be ready to capture
663 * Can change settings like below at this state
664 * - camera device ID setting
665 * - color format setting
666 * - image size setting
667 * - image storing method
669 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
670 * @return Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
671 * @see camerasrc_stop
672 * @note State transition : [CAMERASRC_STATE_REALIZED] => [CAMERASRC_STATE_READY]
673 * Phase description : Running phase
675 int camerasrc_start(camsrc_handle_t handle);
678 * Present user buffer to camerasrc and force to use that buffer.
679 * After calling this API, all core routine of camerasrc camera will use
680 * User pointer method for managing buffers.
682 * @param[in] handle ::camsrc_handle_t camerasrc context handle
683 * @param[in] present_buf ::camerasrc_usr_buf_t Buffer set to present to camerasrc
684 * @param[in] io_method ::camerasrc_io_method_t Enum type represent to IO method
685 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
686 * @see camerasrc_io_method_t
689 int camerasrc_present_usr_buffer(camsrc_handle_t handle, camerasrc_usr_buf_t* present_buf, camerasrc_io_method_t io_method);
692 * Get total number of buffer which managed in camerasrc currently.
693 * If this called, it will return default number of buffer in MMAP mode.
694 * but use this API after calling ::camerasrc_present_usr_buffer , It will
695 * return User specfied buffer number.
697 * @param[in] handle ::camsrc_handle_t camerasrc context handle
698 * @param[in] num_buffer Number of buffer that's managed in camerasrc currently
699 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
700 * @see camerasrc_io_method_t
703 int camerasrc_get_num_buffer(camsrc_handle_t handle, unsigned int* num_buffer);
706 * Get Input/Output method which is used when access camera driver
708 * @param[in] handle ::camsrc_handle_t camerasrc context handle
709 * @param[in] io_method ::camerasrc_io_method_t method enum value
710 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
711 * @see camerasrc_io_method_t
714 int camerasrc_get_io_method(camsrc_handle_t handle, camerasrc_io_method_t* io_method);
717 * Inner ring buffer start refreshing. refresh process occurs asynchronously, and
718 * ::camerasrc_wait_frame_available function can anounce when it is available.
720 * Camera is grabbing High quality, maybe low speed frame(dependent on device)
721 * - Cant approach the [AF] state
722 * - preview frames arent always automatically fed. If not, must request repeatedly
723 * - If device supports continuous focusing, it can be enabled at this state in case
726 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
727 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
728 * @note State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_STILL]
729 * Phase description : Running phase
731 int camerasrc_start_still_stream(camsrc_handle_t handle);
734 * Inner ring buffer start refreshing. refresh process occurs asynchronously, and
735 * ::camerasrc_wait_frame_available function can anounce when it is available.
737 * Camera is grabbing low quality, high speed frame
738 * - Can attempt the [AF] state only at this state
739 * - preview frames are always automatically fed
741 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
742 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
743 * @note State transition : [CAMERASRC_STATE_READY] => [CAMERASRC_STATE_PREVIEW]
744 * Phase description : Running phase
746 int camerasrc_start_preview_stream(camsrc_handle_t handle);
749 * Stop frame refreshing. Ring buffers don't be refreshed any more
751 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
752 * @return Success on ::camerasrc_handle_t or returns NULL code, and displays debug message
753 * @see camerasrc_stop
754 * @note State transition : [CAMERASRC_STATE_STILL/PREVIEW/VIDEO] => [CAMERASRC_STATE_READY]
755 * Phase description : Running phase
757 int camerasrc_stop_stream(camsrc_handle_t handle);
760 * Query image buffer size. buffer allocation guide function.
762 * @param[in] handle ::camsrc_handle_t camerasrc context handle
763 * @param[out] main_img_size main image maximum size
764 * @param[out] thm_img_size thumb nail image maximum size
765 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
768 int camerasrc_query_img_buf_size(camsrc_handle_t handle, unsigned int* main_img_size, unsigned int* thm_img_size);
771 * non-busy waiting function for image frame available
773 * @param[in] handle ::camsrc_handle_t camerasrc context handle
774 * @param[in] timeout main image maximum size
775 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
778 int camerasrc_wait_frame_available(camsrc_handle_t handle, long int timeout);
781 * Check emp shock status
783 * @param[in] handle ::camsrc_handle_t camerasrc context handle
784 * @param[out] check_val
785 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
788 int camerasrc_check_esd_shock(camsrc_handle_t *handle, int *check_val);
791 * Queue(in user space, almost same with free buffer) buffer to dev's ring buffer
793 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
794 * @param[in] buffer ::camerasrc_buffer_t buffer
795 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
798 int camerasrc_queue_buffer(camsrc_handle_t handle, int buf_index, camerasrc_buffer_t *buffer);
801 * Dequeue(Pop) buffer from v4l2 driver to usr space.
803 * @param[in] handle ::camsrc_handle_t camerasrc context handle
804 * @param[out] buf_index main buffer index number to be dequeued.
805 * @param[out] buffer main image buffer
806 * @param[out] thm_buffer thumbnail image buffer
807 * @return Success on ::camsrc_handle_t or returns NULL code, and displays debug message
810 int camerasrc_dequeue_buffer(camsrc_handle_t handle, int *buf_index, camerasrc_buffer_t *buffer, camerasrc_buffer_t *thm_buffer);
813 * Read frame from camera device.
815 * @param[in] handle ::camsrc_handle_t camerasrc context handle
816 * @param[out] buffer ::camerasrc_buffer_t main image buffer to be get.
817 * @param[out] thm_buffer ::camerasrc_buffer_t thumbnail image buffer to be get.
818 * @param[out] buffer_index ::int v4l2 buffer index.
819 * @note if thm_buffer is NULL, thumbnail image will be discarded
822 int camerasrc_read_frame(camsrc_handle_t handle, camerasrc_buffer_t *main_img_buffer, camerasrc_buffer_t *thm_img_buffer, int *buffer_index);
825 * Get screennail buffer
827 * @param[in] handle ::camsrc_handle_t camerasrc context handle
828 * @param[out] scrnl_buf ::camerasrc_buffer_t screennail buffer to be gotten
829 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
831 int camerasrc_get_screennail_buffer(camsrc_handle_t handle, camerasrc_buffer_t *scrnl_buf);
834 * Set autofocus callback. ::camerasrc_callback_t type defined function can be set
836 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
837 * @param[in] cb ::camerasrc_callback_t callback after focusing over
838 * @param[in] use_data ::void * user data pointer that will be passed to callback
839 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
840 * @note Callback function can be set on READY or REALIZED state
843 int camerasrc_set_focused_callback(camsrc_handle_t handle, camerasrc_callback_t cb, void *usr_data);
846 * Set autofocusing area. autofocusing will be performed refer this rect of the preview
848 * @param[in] handle ::camsrc_handle_t camerasrc context handle
849 * @param[in] rect ::camerasrc_rect_t rectangle area for auto focusing
850 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
852 int camerasrc_set_autofocusing_area(camsrc_handle_t handle, camerasrc_rect_t* rect);
855 * Get autofocusing area.
857 * @param[in] handle ::camsrc_handle_t camerasrc context handle
858 * @param[out] rect ::camerasrc_rect_t rectangle area for auto focusing
859 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
861 int camerasrc_get_autofocusing_area(camsrc_handle_t handle, camerasrc_rect_t* rect);
864 * Start auto focusing with ::camerasrc_af_mode. After ::interval time, call the callback
865 * function with ::camerasrc_af_status value.
866 * Auto-focus is in progress. Cant return preview state
867 * before time-out, success, call camerasrc_autofocus_stop
868 * - If focused, focus status will be locked at preview state
870 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
871 * @param[in] af_mode Auto focusing operation mode see ::camerasrc_af_mode
872 * @param[in] interval interval time in millisecond
873 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
874 * @note State transition : [CAMERASRC_STATE_PREVIEW] => [CAMERASRC_STATE_AF_IN_PROGRESS]
875 * Phase description : Running phase
877 int camerasrc_start_autofocusing(camsrc_handle_t handle);
882 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
883 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
884 * @note State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
885 * Phase description : Running phase
887 int camerasrc_stop_autofocusing(camsrc_handle_t handle);
890 * Release auto focusing
892 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
893 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
894 * @note State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
895 * Phase description : Running phase
897 int camerasrc_release_autofocusing(camsrc_handle_t handle);
900 * Initialize auto focusing mode to specified focal length
902 * @param[in] handle ::camsrc_handle_t camerasrc context handle
903 * @param[in] af_mode ::camerasrc_af_mode_t Auto focusing mode
904 * @param[in] af_range ::camerasrc_af_scan_range_t Auto focusing range
905 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
907 int camerasrc_init_autofocusing_mode(camsrc_handle_t handle, camerasrc_af_mode_t af_mode, camerasrc_af_scan_range_t af_range);
910 * Get current auto focusing mode
912 * @param[in] handle ::camsrc_handle_t camerasrc context handle
913 * @param[out] af_mode ::camerasrc_af_mode_t Auto focusing mode
914 * @param[out] af_range ::camerasrc_af_scan_range_t Auto focusing range
915 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
917 int camerasrc_get_autofocusing_mode(camsrc_handle_t handle, camerasrc_af_mode_t* af_mode, camerasrc_af_scan_range_t* af_range);
920 * Get current auto focusing status
922 * @param[in] handle ::camsrc_handle_t camerasrc context handle
923 * @param[out] af_status ::camerasrc_auto_focus_status_t Auto focusing status
924 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
927 int camerasrc_get_autofocusing_status(camsrc_handle_t handle, camerasrc_auto_focus_status_t* af_status);
928 /**** M I S C E L L A N E O U S O P E R A T I O N ****/
930 /**** I N P U T ( C A M D E V I C E ) O P E R A T I O N ****/
933 * Get input camera ID just like ioctl (fd, VIDIOC_G_INPUT, &index)
935 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
936 * @param[out] id Camera ID currently set
937 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
938 * @note This function is only effective at CAMERASRC_PHASE_RUNNING
940 int camerasrc_get_input(camsrc_handle_t handle, camerasrc_dev_id_t* camera_id);
943 * Set input camera ID just like ioctl (fd, VIDIOC_S_INPUT, &index)
945 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
946 * @param[out] camera_id Camera ID currently set
947 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
948 * @note This function is only effective at CAMERASRC_STATE_READY
949 * If you use set_input(), handle will be initiated.
951 int camerasrc_set_input(camsrc_handle_t handle, camerasrc_dev_id_t camera_id);
954 /**** E F F E C T C O N T R O L O P E R A T I O N ****/
957 * Check support controls with ::camerasrc_ctrl_t ID
959 * @param[in] handle ::camsrc_handle_t camerasrc context handle
960 * @param[in] ctrl_id control ID to be checked
961 * @param[out] ctrl_info control information to be got
962 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
964 int camerasrc_query_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, camerasrc_ctrl_info_t* ctrl_info);
967 * Check support controls with ::camerasrc_ctrl_t ID
969 * @param[in] handle ::camsrc_handle_t camerasrc context handle
970 * @param[in] ctrl_id control ID to be checked
971 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
973 int camerasrc_support_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id);
976 * Start facedetection
978 * @param[in] handle ::camsrc_handle_t camerasrc context handle
979 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
980 * @note State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
981 * Phase description : Running phase
983 int camerasrc_start_facedetection(camsrc_handle_t handle);
986 * Stop face detection
988 * @param[in] handle ::camsrc_handle_t camerasrc context handle
989 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
990 * @note State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
991 * Phase description : Running phase
993 int camerasrc_stop_facedetection(camsrc_handle_t handle);
996 * Get face detection status
998 * @param[in] handle ::camsrc_handle_t camerasrc context handle
999 * @param[out] is_detecting whether it is detecting or not
1000 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1001 * @note State transition : [CAMERASRC_STATE_AF_IN_PROGRESS] => [CAMERASRC_STATE_PREVIEW]
1002 * Phase description : Running phase
1004 int camerasrc_get_facedetection(camsrc_handle_t handle, int* is_detecting);
1007 * Control miscellaneous settings through ::camerasrc_ctrl_t IDs
1009 * @param[in] handle ::camsrc_handle_t camerasrc context handle
1010 * @param[in] ctrl_id control ID to be checked
1011 * @param[in] value value to be set
1012 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1013 * @note This function is only effective at CAMERASRC_STATE_READY
1015 int camerasrc_set_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, int value);
1018 * Get the value of miscellaneous settings through ::camerasrc_ctrl_t IDs
1020 * @param[in] handle ::camsrc_handle_t camerasrc context handle
1021 * @param[in] ctrl_id control ID to be checked
1022 * @param[out] value value to be stored
1023 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1024 * @note This function is only effective at CAMERASRC_STATE_READY
1026 int camerasrc_get_control(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, int* value);
1028 /**** O U T P U T C O N T R O L O P E R A T I O N ****/
1031 * Control frame refresh rate setting
1033 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
1034 * @param[in] frac ::camsrc_frac_t time per frame
1035 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1036 * @note This function is only effective at CAMERASRC_STATE_READY
1038 int camerasrc_set_timeperframe(camsrc_handle_t handle, camerasrc_frac_t* frac);
1041 * Set output format of camera device just like ioctl VIDIOC_S_FMT
1043 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
1044 * @param[in] fmt ::camerasrc_format_t output format description to be set
1045 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1046 * @note This function is only effective at CAMERASRC_STATE_READY.
1047 * device dependent function.
1049 int camerasrc_set_format(camsrc_handle_t handle, camerasrc_format_t* fmt);
1052 * Get output format of camera device just like ioctl VIDIOC_G_FMT
1054 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
1055 * @param[in] fmt ::camerasrc_format_t output format description to be set
1056 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1057 * @note This function is only effective at CAMERASRC_PHASE_RUNNING
1059 int camerasrc_get_format(camsrc_handle_t handle, camerasrc_format_t* fmt);
1062 * Try output format of camera device just like ioctl VIDIOC_TRY_FMT
1063 * In this function, it doesn't change any format, only just try. just test
1064 * the combinations of format setting
1066 * @param[in] handle ::camerasrc_handle_t camerasrc context handle
1067 * @param[in] fmt ::camerasrc_format_t output format description to be set
1068 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1069 * @note This function is only effective at CAMERASRC_STATE_READY.
1070 * device dependent function.
1072 int camerasrc_try_format(camsrc_handle_t handle, camerasrc_format_t* fmt);
1075 * Get virtual/physical address of data frame
1077 * @param[in] handle ::camsrc_handle_t handle
1078 * @param[in] ae_lock ::camerasrc_ae_lock_t Auto exposure lock/unlock
1079 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1081 int camerasrc_get_frame_data(camsrc_handle_t handle, camerasrc_frame_data_t * data);
1083 /**** S H U T T E R S P E E D & A P E R T U R E M O D U L A T I O N ****/
1085 * Get exif string to be combined with jpg image from camerasrc
1087 * @param[in] handle ::camsrc_handle_t handle
1088 * @param[out] exif_string exif information string
1089 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1091 int camerasrc_get_exif_info(camsrc_handle_t handle, camerasrc_exif_t* exif_struct);
1094 * Check whether camera device is opened
1096 * @param[in] handle ::camsrc_handle_t handle
1097 * @return 0 when camera is not opened else return non-zero value.
1099 int camerasrc_device_is_open(camsrc_handle_t handle);
1102 * Set the camera device file decriptor
1104 * @param[in] handle ::camsrc_handle_t handle
1105 * @param[in] videofd ::file descriptor of camera device
1106 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1108 int camerasrc_set_videofd(camsrc_handle_t handle,int videofd);
1111 * Set AF behaviour after capturing
1113 * @param[in] handle ::camsrc_handle_t handle
1114 * @param[in] hold_af ::whether holding af after capturing
1115 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1117 int camerasrc_set_af_hold_after_capture(camsrc_handle_t handle, int hold_af);
1120 * Set Sensor mode to camera driver
1122 * @param[in] handle ::camsrc_handle_t handle
1123 * @param[in] sensor_mode ::int mode
1124 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1126 int camerasrc_set_sensor_mode(camsrc_handle_t handle, int mode);
1129 * Set vflip to camera driver
1131 * @param[in] handle ::camsrc_handle_t handle
1132 * @param[in] vflip ::int vflip
1133 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1135 int camerasrc_set_vflip(camsrc_handle_t handle, int vflip);
1138 * Set hflip to camera driver
1140 * @param[in] handle ::camsrc_handle_t handle
1141 * @param[in] hflip ::int hflip
1142 * @return Success on CAMERASRC_ERR_NONE or returns with ::camerasrc_error_t error code
1144 int camerasrc_set_hflip(camsrc_handle_t handle, int hflip);
1146 /* W I L L B E D E P R E C A T E D */
1148 /*! @enum camerasrc_colortone_t
1149 * @brief Enumeration type for camera colortone
1151 * Colortone entries for camera effects. This can be used with CAMERASRC_CTRL_COLOR_TONE
1152 * This values are defined for utility. It's dependent on the device/camera module.
1155 CAMERASRC_COLORTONE_NONE = 0,
1156 CAMERASRC_COLORTONE_NEGATIVE,
1157 CAMERASRC_COLORTONE_SOLARIZATION_1,
1158 CAMERASRC_COLORTONE_SOLARIZATION_2,
1159 CAMERASRC_COLORTONE_SOLARIZATION_3,
1160 CAMERASRC_COLORTONE_SOLARIZATION_4,
1161 CAMERASRC_COLORTONE_EMBOSS,
1162 CAMERASRC_COLORTONE_OUTLINE,
1163 CAMERASRC_COLORTONE_AQUA,
1164 CAMERASRC_COLORTONE_SEPHIA,
1165 CAMERASRC_COLORTONE_GRAY,
1166 CAMERASRC_COLORTONE_B_N_W,
1167 CAMERASRC_COLORTONE_RED,
1168 CAMERASRC_COLORTONE_GREEN,
1169 CAMERASRC_COLORTONE_BLUE,
1170 CAMERASRC_COLORTONE_ANTIQUE,
1171 CAMERASRC_COLORTONE_SKETCH1,
1172 CAMERASRC_COLORTONE_SKETCH2,
1173 CAMERASRC_COLORTONE_SKETCH3,
1174 CAMERASRC_COLORTONE_SKETCH4,
1175 CAMERASRC_COLORTONE_NUM,
1176 }camerasrc_colortone_t;
1178 /*! @enum camerasrc_program_mode_t
1179 * @brief Enumeration type for preset program mode
1184 CAMERASRC_PROGRAM_MODE_NORMAL = 0,
1185 CAMERASRC_PROGRAM_MODE_PORTRAIT,
1186 CAMERASRC_PROGRAM_MODE_LANDSCAPE,
1187 CAMERASRC_PROGRAM_MODE_SPORTS,
1188 CAMERASRC_PROGRAM_MODE_PARTY_N_INDOOR,
1189 CAMERASRC_PROGRAM_MODE_BEACH_N_INDOOR,
1190 CAMERASRC_PROGRAM_MODE_SUNSET,
1191 CAMERASRC_PROGRAM_MODE_DUSK_N_DAWN,
1192 CAMERASRC_PROGRAM_MODE_FALL_COLOR,
1193 CAMERASRC_PROGRAM_MODE_NIGHT_SCENE,
1194 CAMERASRC_PROGRAM_MODE_FIREWORK,
1195 CAMERASRC_PROGRAM_MODE_TEXT,
1196 CAMERASRC_PROGRAM_MODE_SHOW_WINDOW,
1197 CAMERASRC_PROGRAM_MODE_CANDLE_LIGHT,
1198 CAMERASRC_PROGRAM_MODE_BACK_LIGHT,
1199 CAMERASRC_PROGRAM_MODE_NUM,
1200 }camerasrc_program_mode_t;
1202 /*! @enum camerasrc_whitebalance_t
1203 * @brief Enumeration type for preset whitebalance
1208 CAMERASRC_WHITEBALANCE_AUTO = 0,
1209 CAMERASRC_WHITEBALANCE_INCANDESCENT,
1210 CAMERASRC_WHITEBALANCE_FLUORESCENT,
1211 CAMERASRC_WHITEBALANCE_DAYLIGHT,
1212 CAMERASRC_WHITEBALANCE_CLOUDY,
1213 CAMERASRC_WHITEBALANCE_SHADE,
1214 CAMERASRC_WHITEBALANCE_HORIZON,
1215 CAMERASRC_WHITEBALANCE_FLASH,
1216 CAMERASRC_WHITEBALANCE_CUSTOM,
1217 CAMERASRC_WHITEBALANCE_NUM,
1218 }camerasrc_whitebalance_t;
1221 * Enumerations for flip.
1224 CAMERASRC_FILP_NONE = 0, /**< Not flipped */
1225 CAMERASRC_FILP_VERTICAL, /**< Flip vertically */
1226 CAMERASRC_FILP_HORIZONTAL, /**< Flip horizontally */
1227 CAMERASRC_FILP_NUM, /**< Number of flip status */
1230 /*! @enum camerasrc_strobo_status_t
1231 * @brief strobo status
1235 CAMERASRC_STROBO_STATUS_BANNED = 0, /**< strobo off*/
1236 CAMERASRC_STROBO_STATUS_FORCE_ON, /**< strobo on.*/
1237 CAMERASRC_STROBO_STATUS_AUTO, /**< control strobo automatically*/
1238 CAMERASRC_STROBO_STATUS_MOVIE_ON, /**< control strobo automatically*/
1239 CAMERASRC_STROBO_STATUS_NUM, /**< Number of AF status*/
1240 }camerasrc_strobo_status_t;
1241 /*! @enum camerasrc_strobe_mode_t
1242 * @brief strobe mode
1246 CAMERASRC_STROBE_MODE_OFF = 1, /**< off */
1247 CAMERASRC_STROBE_MODE_AUTO, /**< auto */
1248 CAMERASRC_STROBE_MODE_ON, /**< on */
1249 CAMERASRC_STROBE_MODE_PERMANENT, /**< permanent */
1250 CAMERASRC_STROBE_MODE_NUM, /**< Number of strobe mode */
1251 }camerasrc_strobe_mode_t;
1253 /*! @enum camerasrc_ae_mode_t
1254 * @brief Auto exposure mode
1255 * Auto exposure operation mode
1258 CAMERASRC_AE_MODE_OFF = 0,
1259 CAMERASRC_AE_MODE_ALL,
1260 CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_1,
1261 CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_2,
1262 CAMERASRC_AE_MODE_CENTER_WEIGHTED_AVR_3,
1263 CAMERASRC_AE_MODE_SPOT_1,
1264 CAMERASRC_AE_MODE_SPOT_2,
1265 CAMERASRC_AE_MODE_CUSTOM_1,
1266 CAMERASRC_AE_MODE_CUSTOM_2,
1267 } camerasrc_ae_mode_t;
1269 /*! @enum camerasrc_iso_t
1270 * @brief Reserved iso number in definition
1271 * Traditionally predefined ISO values
1274 CAMERASRC_ISO_AUTO = 0,
1284 /*! @enum camerasrc_sensor_mode_t
1285 * @brief Sensor mode in driver
1289 CAMERASRC_SENSOR_MODE_CAMERA = 0,
1290 CAMERASRC_SENSOR_MODE_MOVIE,
1291 } camerasrc_sensor_mode_t;
1293 /*! @def CAMERASRC_SET_SIZE_BY_PRESET_RESOLUTION
1294 * @brief Utility definitions for setting regular size with ::camerasrc_resol_name_t
1296 #define CAMERASRC_SET_SIZE_BY_PRESET_RESOLUTION(format, resolution) { \
1297 memset(&(format.img_size), 0, sizeof(camerasrc_size_t)); \
1298 format.img_size.res = resolution; \
1302 * Set the mode of strobe
1304 * @param[in] handle ::camsrc_handle_t handle
1305 * @param[in] mode ::camerasrc_strobe_mode_t mode of strobe
1306 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1308 int camerasrc_set_strobe_mode(camsrc_handle_t handle, camerasrc_strobe_mode_t mode);
1311 * Get the mode of strobe
1313 * @param[in] handle ::camsrc_handle_t handle
1314 * @param[out] mode ::camerasrc_strobe_mode_t mode of strobe
1315 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1317 int camerasrc_get_strobe_mode(camsrc_handle_t handle, camerasrc_strobe_mode_t* mode);
1320 * Set the mode of auto-exposure processing
1322 * @param[in] handle ::camsrc_handle_t handle
1323 * @param[in] ae_mode ::camerasrc_ae_mode_t AE mode to be set
1324 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1326 int camerasrc_set_exposure_mode(camsrc_handle_t handle, camerasrc_ae_mode_t ae_mode);
1329 * Get the mode of auto-exposure processing
1331 * @param[in] handle ::camsrc_handle_t handle
1332 * @param[out] ae_mode ::camerasrc_ae_mode_t AE mode to be got
1333 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1335 int camerasrc_get_exposure_mode(camsrc_handle_t handle, camerasrc_ae_mode_t* ae_mode);
1338 * Set the shutter speed
1340 * @param[in] handle ::camsrc_handle_t handle
1341 * @param[in] frac ::camerasrc_frac_t shutter speed to be set
1342 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1344 int camerasrc_set_shutter_speed(camsrc_handle_t handle, camerasrc_frac_t frac);
1347 * Get the shutter speed
1349 * @param[in] handle ::camsrc_handle_t handle
1350 * @param[out] frac ::camerasrc_frac_t shutter speed to be got
1351 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1353 int camerasrc_get_shutter_speed(camsrc_handle_t handle, camerasrc_frac_t* frac);
1356 * Set the exposure value
1358 * @param[in] handle ::camsrc_handle_t handle
1359 * @param[in] frac ::camerasrc_frac_t exposure value to be set
1360 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1362 int camerasrc_set_exposure_value(camsrc_handle_t handle, camerasrc_frac_t frac);
1365 * Get the exposure value
1367 * @param[in] handle ::camsrc_handle_t handle
1368 * @param[out] frac ::camerasrc_frac_t exposure value to be got
1369 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1371 int camerasrc_get_exposure_value(camsrc_handle_t handle, camerasrc_frac_t* frac);
1374 * Check whether supports exif embed in jpg or not
1376 * @param[in] handle ::camsrc_handle_t handle
1377 * @param[out] support_exif ::if supports, returns 1 or 0
1378 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1380 int camerasrc_support_embed_exif(camsrc_handle_t handle, int* support_exif);
1383 * Check whether supports jpeg encoding inside camera driver
1385 * @param[in] handle ::camsrc_handle_t handle
1386 * @param[out] support_jpeg_encoding ::if supports, returns 1. If not, return 0
1387 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1389 int camerasrc_support_jpeg_encoding(camsrc_handle_t handle, int* support_jpeg_encoding);
1393 /* For Query functionalities */
1395 * Query basic device info of device
1397 * @param[in] handle ::camsrc_handle_t handle
1398 * @param[out] camerasrc_caps_info_t device information structure
1399 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1401 int camerasrc_read_basic_dev_info(camerasrc_dev_id_t dev_id, camerasrc_caps_info_t* caps_info);
1404 * Query miscellaneous device info(effect, WB, preset values, etc.) of device
1406 * @param[in] handle ::camsrc_handle_t handle
1407 * @param[out] camerasrc_ctrl_list_info_t device capabilities structure
1408 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1410 int camerasrc_read_misc_dev_info(camerasrc_dev_id_t dev_id, camerasrc_ctrl_list_info_t* ctrl_info);
1413 * Query extra device info(face detection, strobe, etc.) of device
1415 * @param[in] handle ::camsrc_handle_t handle
1416 * @param[out] camerasrc_extra_info_t device capabilities structure
1417 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1419 int camerasrc_read_extra_dev_info(camerasrc_dev_id_t dev_id, camerasrc_extra_info_t* extra_info);
1422 * Record miscellaneous device info(effect, WB, preset values, etc.) of device
1424 * @param[in] handle ::camsrc_handle_t handle
1425 * @param[in] camerasrc_ctrl_list_info_t device capabilities structure
1426 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1428 int camerasrc_write_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);
1431 * Record miscellaneous device info(effect, WB, preset values, etc.) of device
1433 * @param[in] handle ::camsrc_handle_t handle
1434 * @param[in] camerasrc_ctrl_list_info_t device capabilities structure
1435 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1437 int camerasrc_write_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_info);
1440 * Record extra device info(face detection, strobe, etc.) of device
1442 * @param[in] handle ::camsrc_handle_t handle
1443 * @param[out] camerasrc_extra_info_t device capabilities structure
1444 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1446 int camerasrc_write_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);
1449 * Query to device driver about basic device info
1451 * @param[in] handle ::camsrc_handle_t handle
1452 * @param[out] camerasrc_ctrl_list_info_t device capabilities structure
1453 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1455 int camerasrc_query_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);
1458 * Query to device driver about miscellaneous device info(effect, WB, preset values, etc.) of device
1460 * @param[in] handle ::camsrc_handle_t handle
1461 * @param[out] camerasrc_ctrl_list_info_t device capabilities structure
1462 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1464 int camerasrc_query_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_list_info);
1465 int camerasrc_query_misc_dev_ctrl_info(camsrc_handle_t handle, camerasrc_ctrl_t ctrl_id, camerasrc_ctrl_info_t* ctrl_info);
1468 * Query to device driver about extra device info(face detection, strobe, etc.) of device
1470 * @param[in] handle ::camsrc_handle_t handle
1471 * @param[out] camerasrc_extra_info_t device capabilities structure
1472 * @return Success(Support) on CAMERASRC_ERR_NONE or returns with ::camerasrc_error error code
1474 int camerasrc_query_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);
1477 * Dump functions for debugging
1479 int camerasrc_dump_basic_dev_info(camsrc_handle_t handle, camerasrc_caps_info_t* caps_info);
1480 int camerasrc_dump_misc_dev_info(camsrc_handle_t handle, camerasrc_ctrl_list_info_t* ctrl_list_info);
1481 int camerasrc_dump_extra_dev_info(camsrc_handle_t handle, camerasrc_extra_info_t* extra_info);
1482 /* END For Query functionalities */
1488 #endif /*__CAMERASRC_H__*/