/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2020. All rights reserved. * Description: Define functions api used to adapter function of camera driver * Create: 2020-02-17 * Author: Camera Group */ #ifndef H_CAMERA_H #define H_CAMERA_H #include #include "limits.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif #endif /* ***********************define public*********************** */ #define cam_str(s) #s #define uapi_camera_ver(a, b, c) "libvendor_camera V" cam_str(a) "." cam_str(b) "." cam_str(c) #define UAPI_CAM_INVALID_ID (0xFFFFFFFF) #define uapi_camera_fourcc(a, b, c, d) \ ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24)) #define UAPI_CAMERA_PIX_FMT_H264 uapi_camera_fourcc('H', '2', '6', '4') /* H264 with start codes */ #define UAPI_CAMERA_PIX_FMT_NV21 uapi_camera_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ #define UAPI_CAMERA_PIX_FMT_RGB24 uapi_camera_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ #define UAPI_CAMERA_PIX_FMT_JPEG uapi_camera_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ #define UAPI_CAMERA_PIX_FMT_H265 uapi_camera_fourcc('H', '2', '6', '5') #define UAPI_CAMERA_PIX_FMT_GREY uapi_camera_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ #define UAPI_CAMERA_PIX_FMT_MJPEG uapi_camera_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ #define UAPI_CAMERA_PIX_FMT_NV12 uapi_camera_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ #define UAPI_CAMERA_PIX_FMT_YUV420 uapi_camera_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ #define UAPI_CAMERA_PIX_FMT_YUYV uapi_camera_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ #define UAPI_CAMERA_PIX_FMT_BGR32 uapi_camera_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ #define UAPI_CAMERA_PIX_FMT_RGB32 uapi_camera_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ #define UAPI_CAMERA_PIX_FMT_YVU420 uapi_camera_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ /* ***********************define error*********************** */ #define UAPI_CAM_ERROR -1 #define UAPI_CAM_NO_ERROR 0 #define UAPI_CAM_INVALID_PARA_ERR (int32_t)(0x80A10001) #define UAPI_CAM_NULL_PTR_ERR (int32_t)(0x80A10002) #define UAPI_CAM_DEV_OPEN_ERR (int32_t)(0x80A10003) #define UAPI_CAM_DEV_CLOSE_ERR (int32_t)(0x80A10004) #define UAPI_CAM_BUFF_SHORT_ERR (int32_t)(0x80A10005) #define UAPI_CAM_NO_INIT_ERR (int32_t)(0x80A10006) #define UAPI_CAM_UNSUPPORT_ERR (int32_t)(0x80A10007) #define UAPI_CAM_CREATE_ERR (int32_t)(0x80A10008) #define UAPI_CAM_DESTROY_ERR (int32_t)(0x80A10009) #define UAPI_CAM_IOCTL_ERR (int32_t)(0x80A10010) #define UAPI_CAM_INVALID_OPT_ERR (int32_t)(0x80A10011) #define UAPI_CAM_TIMEOUT_ERR (int32_t)(0x80A10012) #define UAPI_CAM_MEM_ERR (int32_t)(0x80A10013) #define UAPI_CAM_NO_EXIST (int32_t)(0x80A10014) #define UAPI_CAM_DQDATA_ERR (int32_t)(0x80A10015) /* ***********************define limitations*********************** */ #define UAPI_CAMERA_DESC_MAX_LEN 32 #define UAPI_CAMERA_DEVICE_MAX_NUM 8 #define UAPI_CAMERA_STREAM_MAX_NUM 10 #define UAPI_CAMERA_STREAM_BUFF_MAX_NUM 8 #define UAPI_CAMERA_DEV_PATH_MAX_LEN 64 #define UAPI_CAMERA_CTRL_MAX_DIMS 4 #define UAPI_CAMERA_CTRL_NAME_MAX_LEN 32 #define UAPI_CAMERA_META_QUERY_BUFFER_MAX_LEN 32 #define UAPI_CAMERA_META_TEMPERATURE_MAX_LEN 16 #define UAPI_CAMERA_META_JPEG_THUMB_MAX_NUM 20 #define UAPI_CAMERA_META_SENSOR_AVTIVE_MAX_NUM 20 #define UAPI_CAMERA_META_RATE_MAX_NUM 10 #define UAPI_CAMERA_META_AI_RESULT_MAX_LEN 1024 #define UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN 32 #define UAPI_CAMERA_META_CONFIG_BUFFER_MAX_LEN 64 #define UAPI_CAMERA_CUSTOM_CONFIG_BUFFER_MAX_LEN 4096 #define UAPI_CAMERA_UPDATE_PATH_MAX 256 /* ***********************Define AE meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_AE_MODE_OFF, UAPI_CAMERA_CONTROL_AE_MODE_ON, UAPI_CAMERA_CONTROL_AE_MODE_ON_AUTO_FLASH, UAPI_CAMERA_CONTROL_AE_ON_ALWAYS_FLASH, UAPI_CAMERA_CONTROL_AE_ON_AUTO_FLASH_REDEYE, UAPI_CAMERA_CONTROL_AE_ON_EXTERNAL_FLASH, } uapi_camera_control_ae_mode; typedef enum { UAPI_CAMERA_CONTROL_AE_LOCK_OFF, UAPI_CAMERA_CONTROL_AE_LOCK_ON, } uapi_camera_control_ae_lock_mode; typedef enum { UAPI_CAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE, UAPI_CAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START, UAPI_CAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL, } uapi_camera_control_ae_precap_trigger_mode; typedef enum { UAPI_CAMERA_CONTROL_AE_ANTIBANDING_MODE_OFF, UAPI_CAMERA_CONTROL_AE_ANTIBANDING_MODE_50HZ, UAPI_CAMERA_CONTROL_AE_ANTIBANDING_MODE_60HZ, UAPI_CAMERA_CONTROL_AE_ANTIBANDING_MODE_AUTO } uapi_camera_control_ae_antibanding_mode; typedef enum { UAPI_CAMERA_AE_STATE_INACTIVE, UAPI_CAMERA_AE_STATE_SEARCHING, UAPI_CAMERA_AE_STATE_CONVERGED, UAPI_CAMERA_AE_STATE_LOCKED, UAPI_CAMERA_AE_STATE_FLASH_REQUIRED, UAPI_CAMERA_AE_STATE_PRECAPTURE, } uapi_camera_meta_ae_state; /* ***********************Define AF meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_AF_MODE_OFF, UAPI_CAMERA_CONTROL_AF_MODE_AUTO, UAPI_CAMERA_CONTROL_AF_MODE_MACRO, UAPI_CAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO, UAPI_CAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE, UAPI_CAMERA_CONTROL_AF_MODE_EDOF, } uapi_camera_control_af_mode; typedef enum { UAPI_CAMERA_CONTROL_AF_TRIGGER_IDLE, UAPI_CAMERA_CONTROL_AF_TRIGGER_START, UAPI_CAMERA_CONTROL_AF_TRIGGER_CANCEL, } uapi_camera_control_af_trigger_mode; typedef enum { UAPI_CAMERA_AF_STATE_INACTIVE, UAPI_CAMERA_AF_STATE_PASSIVE_SCAN, UAPI_CAMERA_AF_STATE_PASSIVE_FOCUSED, UAPI_CAMERA_AF_STATE_ACTIVE_SCAN, UAPI_CAMERA_AF_STATE_FOCUSED_LOCKED, UAPI_CAMERA_AF_STATE_NOT_FOCUSED_LOCKED, UAPI_CAMERA_AF_STATE_PASSIVE_UNFOCUSED, } uapi_camera_meta_af_state; /* ***********************Define AWB meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_AWB_MODE_OFF, UAPI_CAMERA_CONTROL_AWB_MODE_AUTO, UAPI_CAMERA_CONTROL_AWB_MODE_INCANDESCENT, UAPI_CAMERA_CONTROL_AWB_MODE_FLUORESCENT, UAPI_CAMERA_CONTROL_AWB_MODE_WARM_FLUORESCENT, UAPI_CAMERA_CONTROL_AWB_MODE_DAYLIGHT, UAPI_CAMERA_CONTROL_AWB_MODE_CLOUDY_DAYLIGHT, UAPI_CAMERA_CONTROL_AWB_MODE_TWILIGHT, UAPI_CAMERA_CONTROL_AWB_MODE_SHADE } uapi_camera_control_awb_mode; typedef enum { UAPI_CAMERA_CONTROL_AWB_LOCK_OFF, UAPI_CAMERA_CONTROL_AWB_LOCK_ON, } uapi_camera_control_awb_lock_mode; typedef enum { UAPI_CAMERA_AWB_STATE_INACTIVE, UAPI_CAMERA_AWB_STATE_SEARCHING, UAPI_CAMERA_AWB_STATE_CONVERGED, UAPI_CAMERA_AWB_STATE_LOCKED, } uapi_camera_meta_awb_state; /* ***********************Define 3A global ctrl meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_MODE_OFF, UAPI_CAMERA_CONTROL_MODE_AUTO, UAPI_CAMERA_CONTROL_MODE_USE_SCENE_MODE, UAPI_CAMERA_CONTROL_MODE_OFF_KEEP_STATE, } uapi_camera_control_3a_global_mode; typedef enum { UAPI_CAMERA_CONTROL_SCENE_MODE_DISABLED, UAPI_CAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY, UAPI_CAMERA_CONTROL_SCENE_MODE_ACTION, UAPI_CAMERA_CONTROL_SCENE_MODE_PORTRAIT, UAPI_CAMERA_CONTROL_SCENE_MODE_LANDSCAPE, UAPI_CAMERA_CONTROL_SCENE_MODE_NIGHT, UAPI_CAMERA_CONTROL_SCENE_MODE_NIGHT_PORTRAIT, UAPI_CAMERA_CONTROL_SCENE_MODE_THEATRE, UAPI_CAMERA_CONTROL_SCENE_MODE_BEACH, UAPI_CAMERA_CONTROL_SCENE_MODE_SNOW, UAPI_CAMERA_CONTROL_SCENE_MODE_SUNSET, UAPI_CAMERA_CONTROL_SCENE_MODE_STEADYPHOTO, UAPI_CAMERA_CONTROL_SCENE_MODE_FIREWORKS, UAPI_CAMERA_CONTROL_SCENE_MODE_SPORTS, UAPI_CAMERA_CONTROL_SCENE_MODE_PARTY, UAPI_CAMERA_CONTROL_SCENE_MODE_CANDLELIGHT, UAPI_CAMERA_CONTROL_SCENE_MODE_BARCODE, UAPI_CAMERA_CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO, UAPI_CAMERA_CONTROL_SCENE_MODE_HDR, UAPI_CAMERA_CONTROL_SCENE_MODE_FACE_PRIORITY_LOW_LIGHT, UAPI_CAMERA_CONTROL_SCENE_MODE_DEVICE_CUSTOM_START, UAPI_CAMERA_CONTROL_SCENE_MODE_DEVICE_CUSTOM_END, } uapi_camera_control_scene_mode; /* ***********************Define flash meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_FLASH_MODE_OFF, UAPI_CAMERA_CONTROL_FLASH_MODE_SINGLE, UAPI_CAMERA_CONTROL_FLASH_MODE_TORCH } uapi_camera_control_flash_mode; /* ***********************Define lens facing options*********************** */ typedef enum { UAPI_CAMERA_LENS_FACING_FRONT, UAPI_CAMERA_LENS_FACING_BACK, UAPI_CAMERA_LENS_FACING_EXTERNAL, } uapi_camera_lens_facing_direction; /* ***********************Define jpeg options*********************** */ typedef struct { uint16_t width; uint16_t height; } uapi_camera_resolution_param; typedef struct { uapi_camera_resolution_param resolution[UAPI_CAMERA_META_JPEG_THUMB_MAX_NUM]; int32_t array_num; } uapi_camera_jpeg_available_thumb_sizes; /* ***********************Define zoom meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_SCALER_CROPPING_TYPE_CENTER_ONLY, UAPI_CAMERA_CONTROL_SCALER_CROPPING_TYPE_FREEFORM, } uapi_camera_control_scaler_cropping_type; /* ***********************Define color aberration meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_COLOR_CORRECTION_ABERRATION_MODE_OFF, UAPI_CAMERA_CONTROL_COLOR_CORRECTION_ABERRATION_MODE_FAST, UAPI_CAMERA_CONTROL_COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY, } uapi_camera_control_color_aberration_mode; /* ***********************Define noise reduction meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE_OFF, UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE_FAST, UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE_HIGH_QUALITY, UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE_MINIMAL, UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG, } uapi_camera_control_noise_reduction_mode; /* ***********************Define DIS,OIS meta options*********************** */ typedef enum { UAPI_CAMERA_CONTROL_VIDEO_STABILIZATION_MODE_OFF, UAPI_CAMERA_CONTROL_VIDEO_STABILIZATION_MODE_ON }uapi_camera_control_video_stablization_mode; /* ***********************Define other meta options*********************** */ typedef enum { UAPI_CAMERA_AE_CUR_MODE, UAPI_CAMERA_AF_CUR_MODE, UAPI_CAMERA_AWB_CUR_MODE, UAPI_CAMERA_3A_CUR_MODE_MAX, } uapi_camera_3a_mode_record; typedef enum { UAPI_CAMERA_SWITCH_MODE_OFF = 0, UAPI_CAMERA_SWITCH_MODE_ON = 1, UAPI_CAMERA_SWITCH_MODE_MAX } uapi_camera_switch_mode; typedef enum { UAPI_CAMERA_ZOOM_NONE = 0, UAPI_CAMERA_ZOOM_RATIO1, // 1.25 UAPI_CAMERA_ZOOM_RATIO2, // 1.50 UAPI_CAMERA_ZOOM_RATIO3, // 1.75 UAPI_CAMERA_ZOOM_RATIO4, // 2.0 UAPI_CAMERA_ZOOM_MAX } uapi_camera_zoom_ratio; typedef enum { UAPI_CAMERA_MODE_NO_SUPPORT = 0, UAPI_CAMERA_MODE_SUPPORT = 1 } uapi_camera_support_mode; typedef enum { UAPI_CAMERA_H264_SVC_MODE_OFF = 0, UAPI_CAMERA_H264_SVC_MODE1, UAPI_CAMERA_H264_SVC_MODE2, UAPI_CAMERA_H264_SVC_MODE_RESERVED } uapi_camera_custom_h264_svc_modes; typedef enum { UAPI_CAMERA_H265_SVC_MODE_OFF = 0, UAPI_CAMERA_H265_SVC_MODE1, UAPI_CAMERA_H265_SVC_MODE_RESERVED } uapi_camera_custom_h265_svc_modes; typedef enum { FALSE = 0, TRUE = 1, } uapi_camera_bool; typedef struct { int32_t left; int32_t top; int32_t width; int32_t height; } uapi_camera_rect; typedef struct { uint32_t id; uint32_t type; char name[UAPI_CAMERA_CTRL_NAME_MAX_LEN]; int64_t minimum; int64_t maximum; uint64_t step; int32_t default_value; uint64_t array_buffer[UAPI_CAMERA_META_QUERY_BUFFER_MAX_LEN]; uint32_t array_num; } uapi_camera_cap_query; typedef struct { uint16_t max_qp; uint16_t min_qp; } uapi_camera_quality_param; /* parameter for Long-term reference frame */ typedef struct { uapi_camera_bool mark_ltr; // FALSE:don't mark ltr, TRUE: mark ltr uapi_camera_bool use_ltr; // FALSE: don't use ltr,TRUE: use ltr int32_t index_ltr; // index of ltr frame } uapi_camera_ltr_param; typedef struct { uapi_camera_resolution_param src_reso; uint32_t src_frame_rate; uapi_camera_resolution_param dest_reso; uint32_t dest_frame_rate; uint32_t flag_reserved; } uapi_camera_sensor_mode; typedef struct { uint8_t config_buffer[UAPI_CAMERA_META_CONFIG_BUFFER_MAX_LEN]; uint32_t valid_len; } uapi_camera_meta_config; typedef struct { uint8_t config_buffer[UAPI_CAMERA_CUSTOM_CONFIG_BUFFER_MAX_LEN]; uint32_t valid_len; } uapi_camera_custom_config; typedef enum { UAPI_CAMERA_UPDATE_STOP, UAPI_CAMERA_UPDATE_START, UAPI_CAMERA_UPDATE_OPER_MAX } uapi_camera_update_isp_oper_mode; typedef enum { UAPI_CAMERA_UPDATE_NOT_SUPPORT, UAPI_CAMERA_UPDATE_OFF_LINE_SUPPORT, /* stop output stream when updating */ UAPI_CAMERA_UPDATE_ON_LINE_SUPPORT, /* continue to output stream must be stopped when updating */ UAPI_CAMERA_UPDATE_MODE_MAX, } uapi_camera_isp_update_mode; typedef enum { UAPI_CAMERA_UPDATE_CONFIG_BY_PATH, UAPI_CAMERA_UPDATE_CONFIG_BY_MEM, UAPI_CAMERA_UPDATE_CONFIG_TYPE_MAX } uapi_camera_isp_update_config_type; typedef struct { uapi_camera_update_isp_oper_mode oper_mode; uint8_t fw_path[256]; uint8_t reserve[60]; } uapi_camera_update_isp_info; typedef enum { UAPI_CAMERA_AI_START, UAPI_CAMERA_AI_STOP, UAPI_CAMERA_AI_CONFIG, UAPI_CAMERA_AI_CMD_MAX } uapi_camera_ai_cmd_type; typedef enum { UAPI_CAMERA_AI_CHILD_MODE, UAPI_CAMERA_AI_AUTO_ZOOM, UAPI_CAMERA_AI_FITNESS, UAPI_CAMERA_AI_GESTURE_CONTROL, UAPI_CAMERA_AI_FACE, UAPI_CAMERA_AI_FACE_FEATURE, UAPI_CAMERA_AI_TYPE_MAX, } uapi_camera_ai_type; typedef struct { uint32_t len; union { void *buffer; // this memeory is always managed by provider, make sure to free it after set/callback uint64_t align; } u; } uapi_camera_ai_info; // server send to tv typedef struct { uapi_camera_ai_cmd_type cmd_type; uapi_camera_ai_type ai_type; uapi_camera_ai_info err_msg; } uapi_camera_ai_cmd_response; // tv send to server typedef struct { uapi_camera_ai_type ai_type; uapi_camera_ai_cmd_type cmd_type; uapi_camera_ai_info config; } uapi_camera_ai_cmd; typedef struct { uint8_t ai_type; // uapi_camera_ai_type uint64_t timestamp; uint32_t result_len; uint8_t result[UAPI_CAMERA_META_AI_RESULT_MAX_LEN]; } uapi_camera_stream_ai_result; typedef enum { UAPI_CAMERA_FRAME_I = 0, UAPI_CAMERA_FRAME_P, UAPI_CAMERA_FRAME_B, UAPI_CAMERA_FRAME_TYPE_MAX } uapi_camera_stream_frame_type; typedef struct { char temperature[UAPI_CAMERA_META_TEMPERATURE_MAX_LEN]; /* 39.2C */ uint8_t is_mark_ltr; uint8_t is_use_ltr; uapi_camera_stream_frame_type frame_type; uint8_t index_ltr; uapi_camera_meta_ae_state ae_state; uapi_camera_meta_af_state af_state; uapi_camera_meta_awb_state awb_state; uint8_t ai_result_num; /* output */ uapi_camera_stream_ai_result ai_result[UAPI_CAMERA_AI_TYPE_MAX]; } uapi_camera_stream_meta_des; /* ***********************Define common data structures.*********************** */ typedef enum { UAPI_CAMERA_PREBUILT = 0, UAPI_CAMERA_COMMON = UAPI_CAMERA_PREBUILT, UAPI_CAMERA_INTERNAL_ISP, UAPI_CAMERA_EXTERNAL_ISP, UAPI_CAMERA_EXTERNAL_ISP_WS, UAPI_CAMERA_COMMON_TB, UAPI_CAMERA_COMMON_TB_BACK, UAPI_CAMERA_COMMON_TB_V3, UAPI_CAMERA_COMMON_TB_V3_REAR, UAPI_CAMERA_COMMON_XR, UAPI_CAMERA_IDEA_START = 0x10, UAPI_CAMERA_CUSTOM_START = 0x100, UAPI_CAMERA_RESERVED_START = 0x200, UAPI_CAMERA_TYPE_MAX } uapi_camera_device_type; typedef enum { UAPI_CAMERA_TRANS_PATH_USB_UVC = 0, UAPI_CAMERA_TRANS_PATH_USB_NET, UAPI_CAMERA_TRANS_PATH_HDMI, UAPI_CAMERA_TRANS_PATH_MAX } uapi_camera_stream_transpath; typedef enum { UAPI_CAMERA_ENCODE_CONTROL_CBR, /* constant bitrate */ UAPI_CAMERA_ENCODE_CONTROL_ABR, /* average bitrate */ UAPI_CAMERA_ENCODE_CONTROL_VBR, /* variable bitrate */ UAPI_CAMERA_ENCODE_CONTROL_MAX } uapi_camera_stream_control_type; typedef enum { UAPI_CAMERA_ENCODE_PROFILE_BASE, UAPI_CAMERA_ENCODE_PROFILE_MAIN, UAPI_CAMERA_ENCODE_PROFILE_HIGH, UAPI_CAMERA_ENCODE_PROFILE_TYPE_MAX } uapi_camera_stream_profile_type; typedef struct { uint32_t camera_id; uapi_camera_device_type type; char dev_path[UAPI_CAMERA_DEV_PATH_MAX_LEN]; uapi_camera_bool multi_stream_supported; uapi_camera_bool usbuvc_stream_supported; uapi_camera_bool usbnet_stream_supported; uapi_camera_bool hdmi_stream_supported; } uapi_camera_device_basic_cap; typedef struct { char description[UAPI_CAMERA_DESC_MAX_LEN]; /* like YUYV 4:2:2 (YUYV) */ uint32_t pixelformat; uint16_t width; uint16_t height; uint8_t frame_rate_num; uint8_t frame_rate[UAPI_CAMERA_META_RATE_MAX_NUM]; } uapi_camera_stream_format_info; typedef struct { uapi_camera_stream_meta_des *meta_buffer; uint8_t *stream_buffer; uint32_t stream_buffer_len; uint32_t stream_valid_len; uint64_t timestamp; void *priv_data; /* hal use only */ uint64_t stream_buffer_phyaddr; uint8_t mem_flag; /* 0:default, mem provided by hal; 1: mem provided by driver */ } uapi_camera_stream_buffer; typedef struct { uint8_t need_sync; // whether this stream needs to be synced on servers side int32_t sync_range_min; // -100 of (-100,100) int32_t sync_range_max; // 100 of (-100,100) } uapi_camera_stream_sync_param; typedef struct { uapi_camera_stream_transpath stream_transpath; uapi_camera_stream_sync_param sync; uapi_camera_stream_format_info format; uapi_camera_custom_h264_svc_modes h264_svc_modes; uapi_camera_custom_h265_svc_modes h265_svc_modes; uint32_t max_stream_len; uint32_t control_type; // uapi_camera_stream_control_type uint32_t profile; // uapi_camera_stream_profile_type uint32_t bit_rate; // KB uint32_t gop; // the interval gap time of I frame uint8_t peak; // the peak rate for one frame uapi_camera_bool enable_cabac; // enable s encode uapi_camera_bool disable_frame; // control stream is output to hal default:FALSE is enable output uapi_camera_bool still_capture; uapi_camera_bool enable_mirror; // to make stream output as mirror image horizonally uapi_camera_bool enable_flip; // to make stream output as mirror image vertically uint32_t user_index; // passthrough the user's index of stream uint8_t reserved; } uapi_camera_stream_init_attr; /* ***********************Define device info*********************** */ typedef enum { // AE UAPI_CAMERA_QUERY_AE_AVAILABLE_MODES = 0, UAPI_CAMERA_QUERY_AE_COMPENSATION_RANGE, UAPI_CAMERA_QUERY_AE_AVAILABLE_ANTIBANDING_MODES, UAPI_CAMERA_QUERY_AE_LOCK_AVAILABLE, UAPI_CAMERA_CONTROL_AE_MODE, UAPI_CAMERA_CONTROL_AE_COMPENSATION, UAPI_CAMERA_CONTROL_AE_ANTIBANDING_MODE, UAPI_CAMERA_CONTROL_AE_LOCK, UAPI_CAMERA_CONTROL_AE_PRECAPTURE_TRIGGER, // AF UAPI_CAMERA_QUERY_AF_AVAILABLE_MODES, UAPI_CAMERA_CONTROL_AF_MODE, UAPI_CAMERA_CONTROL_AF_TRIGGER, // AWB UAPI_CAMERA_QUERY_AWB_AVAILABLE_MODES, UAPI_CAMERA_QUERY_AWB_LOCK_AVAILABLE, UAPI_CAMERA_CONTROL_AWB_MODE, UAPI_CAMERA_CONTROL_AWB_LOCK, // 3A GLOABL CTRL UAPI_CAMERA_QUERY_3A_GLOBAL_AVAILABLE_MODES, UAPI_CAMERA_QUERY_AVAILABLE_SCENE_MODES, UAPI_CAMERA_QUERY_3A_CRTLABLE_MAX_NUM_REGIONS, UAPI_CAMERA_CONTROL_3A_GLOBAL_MODE, UAPI_CAMERA_CONTROL_SCENE_MODE, // flash UAPI_CAMERA_QUERY_FLASH_AVALIABLE, UAPI_CAMERA_CONTROL_FLASH_MODE, // LENS UAPI_CAMERA_QUERY_LENS_MIN_FOCUS_DISTANCE, UAPI_CAMERA_QUERY_LENS_FACING, UAPI_CAMERA_CONTROL_LENS_FOCUS_DISTANCE, // sensor UAPI_CAMERA_QUERY_SENSOR_EXPOSURE_TIME_RANGE, UAPI_CAMERA_QUERY_SENSOR_SENSITIVITY_RANGE, UAPI_CAMERA_QUERY_SENSOR_ORIENTATION, UAPI_CAMERA_CONTROL_SENSOR_EXPOSURE_TIME, UAPI_CAMERA_CONTROL_SENSOR_SENSITIVITY, // other aosp requested infos for device // JPEG UAPI_CAMERA_QUERY_JPEG_MAX_SIZE = 0x100, UAPI_CAMERA_QUERY_JPEG_AVAILABLE_THUMBNAIL_SIZES, UAPI_CAMERA_CONTROL_JPEG_QUALITY, UAPI_CAMERA_CONTROL_JPEG_ORIENTATION, UAPI_CAMERA_CONTROL_JPEG_THUMBNAIL_SIZE, UAPI_CAMERA_CONTROL_JPEG_THUMBNAIL_QUALITY, // zoom UAPI_CAMERA_QUERY_SCALER_CROPPING_TYPE, UAPI_CAMERA_QUERY_SCALER_SENSOR_ACTIVE_ARRAY_SIZE, UAPI_CAMERA_QUERY_SCALER_MAX_ZOOM_SIZE, UAPI_CAMERA_CONTROL_SCALER_CROP_REGION, UAPI_CAMERA_CONTROL_SCALER_CROP_RATIO, // corlor correction UAPI_CAMERA_QUERY_COLOR_CORRECTION_ABERRATION_AVAILABLE_MODES, UAPI_CAMERA_CONTROL_COLOR_CORRECTION_ABERRATION_MODE, // noise UAPI_CAMERA_QUERY_NOISE_REDUCTION_AVAILABLE_MODES, UAPI_CAMERA_CONTROL_NOISE_REDUCTION_MODE, // DIS,OIS UAPI_CAMERA_QUERY_VIDEO_STABILIZATION_AVAILABLE_MODES, UAPI_CAMERA_CONTROL_VIDEO_STABILIZATION_MODE, // extention infos for device UAPI_CAMERA_QUERY_PRIVATE_ZOOM_RANGE = 0x200, UAPI_CAMERA_QUERY_AI_AUTO_ZOOM_SUPPORTED, UAPI_CAMERA_QUERY_AI_FITNESS_MODE_SUPPORTED, UAPI_CAMERA_QUERY_AI_CHILD_MODE_SUPPORTED, UAPI_CAMERA_QUERY_AI_GESTURE_SUPPORTED, UAPI_CAMERA_QUERY_TEMPERATURE_QUERY_SUPPORT, UAPI_CAMERA_CONTROL_TEMPERATURE_MODE, UAPI_CAMERA_QUERY_TEMPERATURE, UAPI_CAMERA_CONTROL_OTP, UAPI_CAMERA_QUERY_SET_SN_SUPPORT, UAPI_CAMERA_CONTROL_SN_ISP, UAPI_CAMERA_CONTROL_SN_BOX, UAPI_CAMERA_QUERY_ISP_VERSION, UAPI_CAMERA_QUERY_INNER_VERSION, UAPI_CAMERA_QUERY_SENSOR_INFO, UAPI_CAMERA_QUERY_ISP_INFO, UAPI_CAMERA_QUERY_PRIVATE_FLASH_STATUS, UAPI_CAMERA_SENSOR_SWITCH_MODE, UAPI_CAMERA_OSD_SWITCH_MODE, UAPI_CAMERA_CUSTOM_QUERY_ODM_CAP, UAPI_CAMERA_CUSTOM_ODM_META_CONTROL, UAPI_CAMERA_QUERY_ISP_UPDATE_MODE, /* only support get */ UAPI_CAMERA_IMAGE_PAUSE_SWITCH_MODE, UAPI_CAMERA_CONTROL_HUE, UAPI_CAMERA_QUERY_H264_SVC_MODES, UAPI_CAMERA_QUERY_H265_SVC_MODES, UAPI_CAMERA_FORMATS_FILTER_DISABLE, UAPI_CAMERA_QUERY_SUPPORT_DYNAMIC_FORMATS, UAPI_CAMERA_DEVICE_INFO_TYPE_MAX } uapi_camera_device_info_type; typedef struct { uapi_camera_device_info_type op_type; union { // standand infos for device // ae uapi_camera_cap_query ae_available_modes; uapi_camera_control_ae_mode ae_mode; uapi_camera_cap_query ae_compensation_range; uint32_t ae_compensation; uapi_camera_support_mode ae_lock_support; uapi_camera_control_ae_lock_mode ae_lock; uapi_camera_control_ae_precap_trigger_mode ae_trigger; // uapi_camera_control_ae_precap_trigger_mode uapi_camera_cap_query ae_antibanding_modes; uapi_camera_control_ae_antibanding_mode ae_antibanding; // af uapi_camera_cap_query af_available_modes; uapi_camera_control_af_mode af_mode; uapi_camera_control_af_trigger_mode af_trigger; // awb uapi_camera_cap_query awb_available_modes; uapi_camera_control_awb_mode awb_mode; uapi_camera_support_mode awb_lock_support; uapi_camera_control_awb_lock_mode awb_lock; // uapi_camera_control_awb_lock_mode // hue uapi_camera_cap_query hue_range; // 3a global ctrl uapi_camera_cap_query ctrl_3a_available_gmodes; uapi_camera_control_3a_global_mode gmode_3a; uapi_camera_cap_query scene_available_modes; uapi_camera_control_scene_mode scene_mode; uapi_camera_cap_query max_num_regions_3a; // flash uapi_camera_support_mode flash_support; // camera flash support uapi_camera_control_flash_mode flash_mode; // lens float lens_min_focus; float lens_focus; uapi_camera_lens_facing_direction lens_facing; // sensor uapi_camera_cap_query sensor_exposure_time_range; uint32_t sensor_exposure_time; uapi_camera_cap_query sensor_iso_range; uint64_t sensor_iso; int32_t sensor_orientation; // 0,90,180,270 // other aosp requested infos for device // jpeg uint32_t jpeg_max_size; uint32_t jpeg_quality; int32_t jpeg_orientation; // 0,90,180,270 uapi_camera_jpeg_available_thumb_sizes query_jpeg_thumb_array; uapi_camera_jpeg_available_thumb_sizes jpeg_thumb_size; uint32_t jpeg_thumb_quality; // 0~100 // zoom uapi_camera_control_scaler_cropping_type scaler_cropping_type; // uapi_camera_control_scaler_cropping_type uapi_camera_rect sensor_active_rect; uint32_t scaler_max_zoom_size; uapi_camera_rect scaler_crop_region; uint32_t scaler_ratio; // corlor correction uapi_camera_cap_query color_aberration_modes; uapi_camera_control_color_aberration_mode color_aber_mode; // noise uapi_camera_cap_query noise_reduction_modes; uapi_camera_control_noise_reduction_mode noise_redct_mode; // DIS,OIS uapi_camera_cap_query video_stablization_modes; uapi_camera_control_video_stablization_mode video_stable_mode; // other extention uapi_camera_cap_query zoom_range; // min 1.0~2.0 step =0.25, refer to uapi_camera_zoom_ratio uapi_camera_support_mode auto_zoom_support; uapi_camera_support_mode ai_fintness_support; // get uapi_camera_support_mode child_support; // get uapi_camera_support_mode gesture_support; // get uapi_camera_support_mode temper_support; // get temperature support uapi_camera_switch_mode temper_mode; // ON/OFF uapi_camera_meta_config temper; // get uint32_t otp_value; uapi_camera_support_mode sn_config_support; // get sn set support uapi_camera_meta_config sn_isp_cfg; uapi_camera_meta_config sn_box_cfg; uapi_camera_meta_config isp_version; uapi_camera_meta_config inner_version; uapi_camera_meta_config sensor_info; uapi_camera_meta_config isp_info; uint32_t priv_flash_state; uapi_camera_sensor_mode sensor_mode; uapi_camera_switch_mode osd_mode; uapi_camera_custom_config odm_cap; uapi_camera_custom_config odm_meta_control; uapi_camera_isp_update_mode isp_update_mode; uapi_camera_switch_mode image_pause_mode; uapi_camera_cap_query h264_svc_available_modes; uapi_camera_cap_query h265_svc_available_modes; uapi_camera_bool formats_filter_disable; uapi_camera_cap_query available_support_dynamic_formats; } u; } uapi_camera_device_info; /* ***********************Define stream info*********************** */ typedef enum { // standand infos for stream UAPI_CAMERA_STREAM_INFO_FORMAT_INFO = 0, UAPI_CAMERA_STREAM_INFO_BITRATE, UAPI_CAMERA_STREAM_INFO_CROPRECT, // AI specific UAPI_CAMERA_STREAM_INFO_EXT_CHILD_MODE = 0x100, UAPI_CAMERA_STREAM_INFO_EXT_CHILD_MODE_CONFIG, // byte[50] UAPI_CAMERA_STREAM_INFO_EXT_AUTO_ZOOM, UAPI_CAMERA_STREAM_INFO_EXT_AUTO_ZOOM_CONFIG, UAPI_CAMERA_STREAM_INFO_EXT_AI_FITNESS_MODE, UAPI_CAMERA_STREAM_INFO_EXT_AI_FITNESS_MODE_CONFIG, // byte[256] UAPI_CAMERA_STREAM_INFO_EXT_GESTURE_MODE, UAPI_CAMERA_STREAM_INFO_EXT_GESTURE_DETECTION_CONFIG, // byte[256] UAPI_CAMERA_STREAM_INFO_EXT_AI_FACE_MODE, UAPI_CAMERA_STREAM_INFO_EXT_AI_FACE_MODE_CONFIG, // byte[256] UAPI_CAMERA_STREAM_INFO_EXT_AI_FACE_FEATURE_MODE, UAPI_CAMERA_STREAM_INFO_EXT_AI_FACE_FEATURE_MODE_CONFIG, // extention infos for stream UAPI_CAMERA_STREAM_INFO_EXT_QUERY_BUFLENGTH = 0x200, UAPI_CAMERA_STREAM_INFO_EXT_QUALITYPARAM, UAPI_CAMERA_STREAM_INFO_EXT_ENABLEREF, /* the state of enable ref */ UAPI_CAMERA_STREAM_INFO_EXT_ENABLELTR, /* the state of enable LTR */ UAPI_CAMERA_STREAM_INFO_EXT_LTRPARAM, /* the param of enable LTR */ UAPI_CAMERA_STREAM_INFO_EXT_IDR, // only set UAPI_CAMERA_STREAM_INFO_EXT_DROPFRAME, UAPI_CAMERA_STREAM_INFO_EXT_ZOOM, UAPI_CAMERA_STREAM_INFO_EXT_SYNC, // set on/off, & the range of sync UAPI_CAMERA_STREAM_INFO_DYNAMIC_FORMAT, UAPI_CAMERA_STREAM_INFO_H264_SVC_MODE, UAPI_CAMERA_STREAM_INFO_H265_SVC_MODE, UAPI_CAMERA_STREAM_INFO_MAX_STREAM_LEN, UAPI_CAMERA_STREAM_INFO_UPDATE_USER_INDEX, UAPI_CAMERA_STREAM_INFO_TYPE_MAX } uapi_camera_stream_info_type; typedef struct { uapi_camera_stream_info_type type; union { // standand infos for stream uapi_camera_stream_format_info format_info; uint32_t bit_rate; uapi_camera_rect crop_param; // ai specific uapi_camera_switch_mode child_mode; // set uapi_camera_ai_info child_cfg; // set uapi_camera_switch_mode auto_zoom_mode; uapi_camera_ai_info auto_zoom_cfg; // set uapi_camera_switch_mode ai_fitness_mode; // set uapi_camera_ai_info ai_fintness_cfg; // set uapi_camera_switch_mode gesture_mode; // set uapi_camera_ai_info gesture_cfg; // set uapi_camera_switch_mode ai_face_mode; // set uapi_camera_ai_info ai_face_cfg; // set uapi_camera_switch_mode ai_face_feature_mode; // set uapi_camera_ai_info ai_face_feature_cfg; // set // extention infos for stream uint32_t stream_buff_length; uapi_camera_quality_param quality_param; // get & set uapi_camera_bool enable_ref; // get & set uapi_camera_bool enable_ltr; // get & set uapi_camera_ltr_param ltr_param; // get & set uint32_t drop_frame_type; // get & set uapi_camera_zoom_ratio zoom_ratio; // get & set uapi_camera_stream_sync_param sync; uint32_t dynamic_format; uapi_camera_custom_h264_svc_modes h264_svc_mode; uapi_camera_custom_h265_svc_modes h265_svc_mode; uint32_t max_stream_len; uint32_t user_index; // the user's index of stream } u; } uapi_camera_stream_info; /* ***********************Define extention info*********************** */ typedef enum { UAPI_CAMERA_SENSOR_INIT_EXCEPTION = 1, // CameraRuntimeException UAPI_CAMERA_MEMORY_ALLOC_EXCEPTION = 2, // CameraRuntimeException UAPI_CAMERA_AI_MODULE_LOAD_EXCEPTION = 3, // CameraAiException UAPI_CAMERA_AI_MODULE_CLOSE_EXCEPTION = 4, // CameraAiException UAPI_CAMERA_AI_MODULE_RUNTIME_EXCEPTION = 5, // CameraAiException UAPI_CAMERA_UPGRADE_FILE_TRANS_EXCEPTION = 6, // CameraUpgradeException UAPI_CAMERA_UPGRADE_FILE_CHECK_EXCEPTION = 7, // CameraUpgradeException UAPI_CAMERA_UPGRADE_FILE_INSTALL_EXCEPTION = 8, // CameraUpgradeException UAPI_CAMERA_UPGRADE_RESULT_STATISTICS = 9, UAPI_CAMERA_MOTOR_UP_DOWN_STATISTICS = 10, } uapi_camera_exception_type; typedef struct { int32_t err_type; int32_t status_code; char version[UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN]; } uapi_camera_runtime_exception; typedef struct { int32_t err_type; int32_t status_code; char version[UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN]; int32_t ai_id; } uapi_camera_ai_exception; typedef struct { int32_t err_type; int32_t status_code; char current_version[UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN]; char target_version[UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN]; } uapi_camera_upgrade_exception; typedef struct { int32_t result; char version[UAPI_CAMERA_META_EXCPT_VERS_MAX_LEN]; } uapi_camera_upgrade_statistics; typedef struct { int32_t up_times; int32_t down_times; } uapi_camera_motor_statistics; typedef struct { uapi_camera_exception_type ex_type; union { uapi_camera_runtime_exception sensor_init_err; uapi_camera_runtime_exception mem_alloc_err; uapi_camera_ai_exception ai_load_err; uapi_camera_ai_exception ai_close_err; uapi_camera_ai_exception ai_run_err; uapi_camera_upgrade_exception upgrade_trans_err; uapi_camera_upgrade_exception upgrade_verify_err; uapi_camera_upgrade_exception upgrade_install_err; uapi_camera_upgrade_statistics upgrade_statistics; uapi_camera_motor_statistics motor_statistics; } u; } uapi_camera_exception; typedef enum { UAPI_CAMERA_MODULE_AI_CHILD = 0, UAPI_CAMERA_MODULE_AI_AUTO_ZOOM, UAPI_CAMERA_MODULE_AI_FITNESS, UAPI_CAMERA_MODULE_AI_GESTURE, UAPI_CAMERA_MODULE_AI_FACE, UAPI_CAMERA_MODULE_AI_FACE_FEATURE, UAPI_CAMERA_MODULE_UPDATE = 0x100, UAPI_CAMERA_MODULE_OSD, UAPI_CAMERA_MODULE_TYPE_MAX, } uapi_camera_module_type; typedef enum { UAPI_CAMERA_MODULE_INSTALL_SUCCESS, UAPI_CAMERA_MODULE_INSTALL_FAILED, UAPI_CAMERA_MODULE_INSTALL_ING, UAPI_CAMERA_MODULE_INSTALL_STATE_MAX, } uapi_camera_module_install_state; typedef enum { UAPI_CAMERA_MODULE_INSTALL_BY_PATH, UAPI_CAMERA_MODULE_INSTALL_BY_MEM, UAPI_CAMERA_MODULE_INSTALL_MODE_MAX, } uapi_camera_module_install_mode; typedef struct { uapi_camera_module_type type; uapi_camera_module_install_state state; uint32_t progress; /* 0-100 */ } uapi_camera_module_install_result; typedef struct { uint32_t len; void *buffer; // this memeory is always managed by provider, make sure to free it after set/callback } uapi_camera_module_install_mem; typedef struct { uapi_camera_module_type module_type; uapi_camera_module_install_mode install_mode; uapi_camera_rect rect; union { char module_file_path[PATH_MAX]; uapi_camera_module_install_mem module_mem; } u; } uapi_camera_module_package; typedef enum { UAPI_CAMERA_REPORT_EXCEPTION = 0, UAPI_CAMERA_REPORT_AICMD_RESPONSE, UAPI_CAMERA_REPORT_MODULE_RESULT, UAPI_CAMERA_REPORT_ISP_UPDATE_RESULT, UAPI_CAMERA_REPORT_TYPE_MAX, } uapi_camera_report_type; typedef struct { uapi_camera_report_type report_type; union { uapi_camera_exception exception; uapi_camera_ai_cmd_response ai_cmd_err; uapi_camera_module_install_result module_result; } u; } uapi_camera_report_package; typedef enum { UAPI_CAMERA_HOTPLUG_IN = 0, UAPI_CAMERA_HOTPLUG_OUT, } uapi_camera_hotplug_type; typedef struct { char dev_path[UAPI_CAMERA_DEV_PATH_MAX_LEN]; uapi_camera_hotplug_type event_type; uapi_camera_bool force_cb; /* true: force to callback event , not check */ } uapi_camera_hotplug_event_msg; typedef enum { UAPI_CAMERA_STATE_MONITOR_REQ_DUMP = 0, UAPI_CAMERA_STATE_MONITOR_MSG_MAX_LIMIT, UAPI_CAMERA_STATE_MONITOR_TYPE_MAX, } uapi_camera_state_monitor_type; typedef struct { uapi_camera_state_monitor_type monitor_type; union { int32_t camera_id; int32_t msg_max_limit; // MB, <0: no limit } u; } uapi_camera_state_monitor; /* ***********************Define api*********************** */ /* function: callback data to caller params: stream_id: created by uapi_camera_stream_create buffer: the buffer including valid data, configured by uapi_camera_stream_request. */ typedef void (*uapi_camera_stream_callback_func)(uint32_t stream_id, const uapi_camera_stream_buffer *buffer); /* function: callback data to caller params: streamId: created by uapi_camera_stream_create buffer: the buffer including report data. */ typedef void (*uapi_camera_report_callback_func)(uint32_t camera_id, const uapi_camera_report_package *buffer); /* function: callback data to caller params: msg: the message including device name and hotplug type */ typedef void (*uapi_camera_hotplug_callback_func)(const uapi_camera_hotplug_event_msg *msg); /* function: callback state monitor request to caller params: msg: the message including state monitor request */ typedef void (*uapi_camera_state_monitor_callback_func)(const uapi_camera_state_monitor *msg); /* function: camera driver init return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_init(void); /* function: camera driver deinit return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_deinit(void); /* function: get all the available camera devices and their basic info. params: camera_list: alloced by caller, to feed back the camera list camera_num: input: the alloced element number of camera list output: the actual available number return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_device_get_list(uapi_camera_device_basic_cap *camera_list, uint32_t list_num, uint32_t *camera_num); int32_t uapi_camera_device_get_basic_cap(uint32_t camera_id, uapi_camera_device_basic_cap *cap); /* function: open camera. params: camera_id: got from uapi_camera_device_get_List. return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_device_open(uint32_t camera_id); /* function: close camera. params: camera_id: got from uapi_camera_device_get_List. return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_device_close(uint32_t camera_id); /* function: get all formats params: camera_id: got from uapi_camera_device_get_List. format_array: to save all formats arrayLength: input as the length of format_array ouput as the actual number of formats saved in arrayLength; return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_device_get_formats_size(uint32_t camera_id, uint32_t *fromat_num); int32_t uapi_camera_device_get_formats(uint32_t camera_id, uapi_camera_stream_format_info *format_array, const int32_t array_length); /* function: get/set other info params: cameraId: got from uapi_camera_device_get_List. return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_device_get_info(uint32_t camera_id, uapi_camera_device_info *info); int32_t uapi_camera_device_set_info(uint32_t camera_id, const uapi_camera_device_info *info); /* function: create stream channel params: camera_id: got from uapi_camera_device_get_list. attr: the stream basic attributions stream_id: get the stream id alloced by driver return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_create(uint32_t camera_id, const uapi_camera_stream_init_attr *attr, uint32_t *stream_id); /* function: destroy stream channel params: stream_id: got from uapi_camera_stream_create. return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_destroy(uint32_t stream_id); /* function: register callback for one specific stream. If no callback is set by uapi_camera_stream_request, then all the frames of current stream will be sent back from this callback params: stream_id: created by uapi_camera_stream_create callback: see uapi_camera_stream_callback_func priv_data: keep reserve private data process return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_register_callback(uint32_t stream_id, const uapi_camera_stream_callback_func callback); /* function: unregister callback for one specific stream. If no callback is set by uapi_camera_stream_request, then all the frames of current stream will be sent back from this callback params: stream_id: created by uapi_camera_stream_create callback: set to NULL return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_unregister_callback(uint32_t stream_id, const uapi_camera_stream_callback_func callback); /* function: request stream with specific buffer and callback. the parameter "callback" can be set as null. params: stream_id: created by uapi_camera_stream_create stream_buffer: pointer to the array of stream buffer for saving stream data directly. buf_num: the number of elements in stream_buffer, max number is UAPI_CAMERA_STREAM_BUFF_MAX_NUM. return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_request(uint32_t stream_id, const uapi_camera_stream_buffer *stream_buffer, const uint8_t buffer_num); /* function: start tream capture params: stream_id: created by uapi_camera_stream_create return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_on(uint32_t stream_id); /* function: stop stream capture params: stream_id: created by uapi_camera_stream_create return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_off(uint32_t stream_id); /* function: other information exchange, including configuration for stream before start capture params: stream_id: created by uapi_camera_stream_create return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_stream_get_info(uint32_t stream_id, uapi_camera_stream_info *info); int32_t uapi_camera_stream_set_info(uint32_t stream_id, const uapi_camera_stream_info *info); int32_t uapi_camera_module_install(uint32_t camera_id, const uapi_camera_module_package *module, uapi_camera_bool sync); int32_t uapi_camera_module_uninstall(uint32_t camera_id, const uapi_camera_module_package *module); /* function: register callback for reporting AI response or exception to HAL params: camera_id: created by uapi_camera_stream_create callback: see uapi_camera_stream_callback_func priv_data: keep reserve private data process return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_report_register_callback(uint32_t camera_id, const uapi_camera_report_callback_func callback, const void *priv_data); int32_t uapi_camera_report_unregister_callback(uint32_t camera_id, const uapi_camera_report_callback_func callback); /* function: register callback for hotplug type to HAL params: callback: see uapi_camera_hotplug_callback_func return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_hotplug_register_callback(const uapi_camera_hotplug_callback_func callback); int32_t uapi_camera_hotplug_unregister_callback(); /* function: register callback for get state monitor request msg to caller, such as hal params: callback: see uapi_camera_state_monitor_callback_func return: UAPI_CAM_NO_ERROR:success other:error */ int32_t uapi_camera_state_monitor_register_callback(const uapi_camera_state_monitor_callback_func callback); int32_t uapi_camera_state_monitor_unregister_callback(); #ifdef __cplusplus #if __cplusplus } #endif #endif #endif