int32_t mm_camera_action_stop(mm_camera_obj_t *my_obj, mm_camera_ops_type_t opcode, void *parm) { int32_t rc = -MM_CAMERA_E_GENERAL; mm_camera_channel_type_t ch_type; if(opcode == MM_CAMERA_OPS_FOCUS) { if(!parm) return rc; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_AUTO_FOCUS_CANCEL, 0, NULL); } ch_type = mm_camera_util_opcode_2_ch_type(my_obj, opcode); switch(my_obj->op_mode) { case MM_CAMERA_OP_MODE_CAPTURE: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_SNAPSHOT: case MM_CAMERA_OPS_RAW: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_OFF, NULL); CDBG("%s:CAPTURE mode STREAMOFF rc=%d\n",__func__, rc); break; default: break; } break; case MM_CAMERA_OP_MODE_VIDEO: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_VIDEO: rc = mm_camera_ch_fn(my_obj , ch_type, MM_CAMERA_STATE_EVT_STREAM_OFF, NULL); CDBG("%s:VIDEO mode STREAMOFF rc=%d\n",__func__, rc); break; default: break; } break; case MM_CAMERA_OP_MODE_ZSL: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_ZSL: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_OFF, NULL); break; default: break; } break; default: break; } CDBG("%s:ch=%d\n",__func__, ch_type); return rc; }
int32_t mm_camera_prepare_buf(mm_camera_obj_t * my_obj, mm_camera_reg_buf_t *buf) { int32_t rc = -MM_CAMERA_E_GENERAL; rc = mm_camera_ch_fn(my_obj, buf->ch_type, MM_CAMERA_STATE_EVT_REG_BUF, (void *)&buf->preview); return rc; }
int32_t mm_camera_close(mm_camera_obj_t *my_obj) { int i, rc = 0; for(i = 0; i < MM_CAMERA_CH_MAX; i++){ mm_camera_ch_fn(my_obj, (mm_camera_channel_type_t)i, MM_CAMERA_STATE_EVT_RELEASE, NULL); } my_obj->op_mode = MM_CAMERA_OP_MODE_NOTUSED; if(my_obj->ctrl_fd > 0) { rc = close(my_obj->ctrl_fd); if(rc < 0) { /* this is a dead end. */ CDBG("%s: !!!!FATAL ERROR!!!! ctrl_fd = %d, rc = %d", __func__, my_obj->ctrl_fd, rc); } my_obj->ctrl_fd = 0; } if(my_obj->ds_fd > 0) { mm_camera_socket_close(my_obj->ds_fd); my_obj->ds_fd = 0; } return MM_CAMERA_OK; }
int32_t mm_camera_unprepare_buf(mm_camera_obj_t * my_obj, mm_camera_channel_type_t ch_type) { int32_t rc = -MM_CAMERA_E_GENERAL; rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_UNREG_BUF, NULL); return rc; }
int32_t mm_camera_unprepare_buf(mm_camera_obj_t * my_obj, mm_camera_channel_type_t ch_type) { int32_t rc = -MM_CAMERA_E_GENERAL; pthread_mutex_lock(&my_obj->ch[ch_type].mutex); rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_UNREG_BUF, NULL); pthread_mutex_unlock(&my_obj->ch[ch_type].mutex); return rc; }
int32_t mm_camera_set_parm(mm_camera_obj_t * my_obj, mm_camera_parm_t *parm) { int32_t rc = -1; uint16_t len; CDBG("%s type =%d", __func__, parm->parm_type); switch(parm->parm_type) { case MM_CAMERA_PARM_OP_MODE: rc = mm_camera_util_set_op_mode(my_obj, (mm_camera_op_mode_type_t *)parm->p_value); break; case MM_CAMERA_PARM_DIMENSION: rc = mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_PARM_DIMENSION, sizeof(cam_ctrl_dimension_t), parm->p_value); if(rc != MM_CAMERA_OK) { CDBG("%s: mm_camera_send_native_ctrl_cmd err=%d\n", __func__, rc); break; } memcpy(&my_obj->dim, (cam_ctrl_dimension_t *)parm->p_value, sizeof(cam_ctrl_dimension_t)); CDBG("%s: dw=%d,dh=%d,vw=%d,vh=%d,pw=%d,ph=%d,tw=%d,th=%d,raw_w=%d,raw_h=%d\n", __func__, my_obj->dim.display_width,my_obj->dim.display_height, my_obj->dim.video_width, my_obj->dim.video_height, my_obj->dim.picture_width,my_obj->dim.picture_height, my_obj->dim.ui_thumbnail_width,my_obj->dim.ui_thumbnail_height, my_obj->dim.raw_picture_width,my_obj->dim.raw_picture_height); break; case MM_CAMERA_PARM_SNAPSHOT_BURST_NUM: CDBG("%s: Setting snapshot burst number: %d\n", __func__, *((int *)parm->p_value)); my_obj->snap_burst_num_by_user = *((int *)parm->p_value); rc = MM_CAMERA_OK; break; case MM_CAMERA_PARM_CH_IMAGE_FMT: { mm_camera_ch_image_fmt_parm_t *fmt; fmt = (mm_camera_ch_image_fmt_parm_t *)parm->p_value; rc = mm_camera_ch_fn(my_obj, fmt->ch_type, MM_CAMERA_STATE_EVT_SET_FMT, fmt); } break; case MM_CAMERA_PARM_CHECK_AF_RETRY: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_CHECK_AF_RETRY, 0, (void *)NULL); case MM_CAMERA_PARM_LG_CAF_LOCK: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_LG_CAF_LOCK, 0, (void *)NULL); case MM_CAMERA_PARM_INFORM_STARTPRVIEW: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_INFORM_STARTPREVIEW, 0, (void *)NULL); default: rc = mm_camera_set_general_parm(my_obj, parm); break; } return rc; }
int32_t mm_camera_close(mm_camera_obj_t *my_obj) { int i; for(i = 0; i < MM_CAMERA_CH_MAX; i++){ mm_camera_ch_fn(my_obj, (mm_camera_channel_type_t)i, MM_CAMERA_STATE_EVT_RELEASE, NULL); } my_obj->op_mode = MM_CAMERA_OP_MODE_NOTUSED; if(my_obj->ctrl_fd > 0) { close(my_obj->ctrl_fd); my_obj->ctrl_fd = 0; } return MM_CAMERA_OK; }
int32_t mm_camera_set_parm(mm_camera_obj_t * my_obj, mm_camera_parm_t *parm) { int32_t rc = -1; uint16_t len; switch(parm->parm_type) { case MM_CAMERA_PARM_OP_MODE: rc = mm_camera_util_set_op_mode(my_obj, (mm_camera_op_mode_type_t *)parm->p_value); break; case MM_CAMERA_PARM_DIMENSION: rc = mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_PARM_DIMENSION, sizeof(cam_ctrl_dimension_t), parm->p_value); if(rc != MM_CAMERA_OK) { CDBG("%s: mm_camera_send_native_ctrl_cmd err=%d\n", __func__, rc); break; } memcpy(&my_obj->dim, (cam_ctrl_dimension_t *)parm->p_value, sizeof(cam_ctrl_dimension_t)); CDBG("%s: dw=%d,dh=%d,vw=%d,vh=%d,pw=%d,ph=%d,tw=%d,th=%d,raw_w=%d,raw_h=%d\n", __func__, my_obj->dim.display_width,my_obj->dim.display_height, my_obj->dim.video_width,my_obj->dim.video_height, my_obj->dim.picture_width,my_obj->dim.picture_height, my_obj->dim.ui_thumbnail_width,my_obj->dim.ui_thumbnail_height, my_obj->dim.raw_picture_width,my_obj->dim.raw_picture_height); break; case MM_CAMERA_PARM_SNAPSHOT_BURST_NUM: break; case MM_CAMERA_PARM_CH_IMAGE_FMT: { mm_camera_ch_image_fmt_parm_t *fmt; fmt = (mm_camera_ch_image_fmt_parm_t *)parm->p_value; rc = mm_camera_ch_fn(my_obj, fmt->ch_type, MM_CAMERA_STATE_EVT_SET_FMT, fmt); } break; default: rc = mm_camera_set_general_parm(my_obj, parm); break; } return rc; }
int32_t mm_camera_action_start(mm_camera_obj_t *my_obj, mm_camera_ops_type_t opcode, void *parm) { int32_t rc = -MM_CAMERA_E_GENERAL; int send_on_off_evt = 1; mm_camera_channel_type_t ch_type; switch(opcode) { case MM_CAMERA_OPS_FOCUS: { if(!parm) return rc; if(0 > mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_PARM_AUTO_FOCUS, sizeof(isp3a_af_mode_t), parm)) mm_camera_send_af_failed_event(my_obj); return MM_CAMERA_OK; } case MM_CAMERA_OPS_GET_BUFFERED_FRAME: { mm_camera_ops_parm_get_buffered_frame_t *tmp = (mm_camera_ops_parm_get_buffered_frame_t *)parm; rc = mm_camera_ch_fn(my_obj, tmp->ch_type, MM_CAMERA_STATE_EVT_DISPATCH_BUFFERED_FRAME, NULL); return rc; } default: break; } ch_type = mm_camera_util_opcode_2_ch_type(my_obj, opcode); CDBG("%s:ch=%d,op_mode=%d,opcode=%d\n", __func__,ch_type,my_obj->op_mode,opcode); switch(my_obj->op_mode) { case MM_CAMERA_OP_MODE_ZSL: case MM_CAMERA_OP_MODE_CAPTURE: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_SNAPSHOT: case MM_CAMERA_OPS_ZSL: case MM_CAMERA_OPS_RAW: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_ON, NULL); break; default: break; } break; case MM_CAMERA_OP_MODE_VIDEO: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_VIDEO: case MM_CAMERA_OPS_SNAPSHOT: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_ON, NULL); CDBG("%s: op_mode=%d, ch %d, rc=%d\n", __func__, MM_CAMERA_OP_MODE_VIDEO, ch_type ,rc); break; case MM_CAMERA_OPS_PREPARE_SNAPSHOT: send_on_off_evt = 0; rc = mm_camera_send_native_ctrl_timeout_cmd(my_obj,CAMERA_PREPARE_SNAPSHOT, 0, NULL, 2000); CDBG("%s: prepare snapshot done opcode = %d, rc= %d\n", __func__, opcode, rc); break; default: break; } break; default: break; } CDBG("%s: ch=%d,op_mode=%d,opcode=%d\n", __func__, ch_type, my_obj->op_mode, opcode); if(send_on_off_evt) rc = mm_camera_send_ch_on_off_event(my_obj,ch_type,MM_CAMERA_CH_EVT_STREAMING_ON); return rc; }
int32_t mm_camera_get_parm(mm_camera_obj_t * my_obj, mm_camera_parm_t *parm) { int32_t rc = MM_CAMERA_OK; switch(parm->parm_type) { case MM_CAMERA_PARM_CROP: return rc = mm_camera_ch_fn(my_obj, ((mm_camera_ch_crop_t *)parm->p_value)->ch_type, MM_CAMERA_STATE_EVT_GET_CROP, parm->p_value); break; case MM_CAMERA_PARM_DIMENSION: memcpy(parm->p_value, &my_obj->dim, sizeof(my_obj->dim)); CDBG("%s: dw=%d,dh=%d,vw=%d,vh=%d,pw=%d,ph=%d,tw=%d,th=%d,ovx=%x,ovy=%d,opx=%d,opy=%d, m_fmt=%d, t_ftm=%d\n", __func__, my_obj->dim.display_width,my_obj->dim.display_height, my_obj->dim.video_width,my_obj->dim.video_height, my_obj->dim.picture_width,my_obj->dim.picture_height, my_obj->dim.ui_thumbnail_width,my_obj->dim.ui_thumbnail_height, my_obj->dim.orig_video_width,my_obj->dim.orig_video_height, my_obj->dim.orig_picture_width,my_obj->dim.orig_picture_height, my_obj->dim.main_img_format, my_obj->dim.thumb_format); break; case MM_CAMERA_PARM_MAX_PICTURE_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_pict_height; dim->width = my_obj->properties.max_pict_width; CDBG("%s: Max Picture Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_RAW_SNAPSHOT_FMT: *((cam_format_t *)parm->p_value) = my_obj->properties.pxlcode; break; case MM_CAMERA_PARM_PREVIEW_FORMAT: *((int *)parm->p_value) = my_obj->properties.preview_format; break; case MM_CAMERA_PARM_PREVIEW_SIZES_CNT: *((int *)parm->p_value) = my_obj->properties.preview_sizes_cnt; break; case MM_CAMERA_PARM_VIDEO_SIZES_CNT: *((int *)parm->p_value) = my_obj->properties.video_sizes_cnt; break; case MM_CAMERA_PARM_THUMB_SIZES_CNT: *((int *)parm->p_value) = my_obj->properties.thumb_sizes_cnt; break; case MM_CAMERA_PARM_HFR_SIZES_CNT: *((int *)parm->p_value) = my_obj->properties.hfr_sizes_cnt; break; case MM_CAMERA_PARM_HFR_FRAME_SKIP: *((int *)parm->p_value) = my_obj->properties.hfr_frame_skip; break; case MM_CAMERA_PARM_DEFAULT_PREVIEW_WIDTH: *((int *)parm->p_value) = my_obj->properties.default_preview_width; break; case MM_CAMERA_PARM_DEFAULT_PREVIEW_HEIGHT: *((int *)parm->p_value) = my_obj->properties.default_preview_height; break; case MM_CAMERA_PARM_BESTSHOT_RECONFIGURE: *((int *)parm->p_value) = my_obj->properties.bestshot_reconfigure; break; case MM_CAMERA_PARM_MAX_PREVIEW_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_preview_height; dim->width = my_obj->properties.max_preview_width; CDBG("%s: Max Preview Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_MAX_VIDEO_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_video_height; dim->width = my_obj->properties.max_video_width; CDBG("%s: Max Video Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_MAX_HFR_MODE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_MAX_HFR_MODE, sizeof(camera_hfr_mode_t), (void *)parm->p_value); case MM_CAMERA_PARM_FOCAL_LENGTH: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_FOCAL_LENGTH, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_HORIZONTAL_VIEW_ANGLE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_HORIZONTAL_VIEW_ANGLE, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_VERTICAL_VIEW_ANGLE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_VERTICAL_VIEW_ANGLE, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_FOCUS_DISTANCES: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_FOCUS_DISTANCES, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_QUERY_FALSH4SNAP: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_QUERY_FLASH_FOR_SNAPSHOT, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_3D_FRAME_FORMAT: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_3D_FRAME_FORMAT, sizeof(camera_3d_frame_t), (void *)parm->p_value); case MM_CAMERA_PARM_MAXZOOM: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_MAXZOOM, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_ZOOM_RATIO: { mm_camera_zoom_tbl_t *tbl = (mm_camera_zoom_tbl_t *)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_ZOOMRATIOS, sizeof(int16_t)*tbl->size, tbl->zoom_ratio_tbl); } case MM_CAMERA_PARM_DEF_PREVIEW_SIZES: { default_sizes_tbl_t *tbl = (default_sizes_tbl_t*)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_DEF_PREVIEW_SIZES, sizeof(struct camera_size_type)*tbl->tbl_size, tbl->sizes_tbl); } case MM_CAMERA_PARM_DEF_VIDEO_SIZES: { default_sizes_tbl_t *tbl = (default_sizes_tbl_t*)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_DEF_VIDEO_SIZES, sizeof(struct camera_size_type)*tbl->tbl_size, tbl->sizes_tbl); } case MM_CAMERA_PARM_DEF_THUMB_SIZES: { default_sizes_tbl_t *tbl = (default_sizes_tbl_t*)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_DEF_THUMB_SIZES, sizeof(struct camera_size_type)*tbl->tbl_size, tbl->sizes_tbl); } case MM_CAMERA_PARM_DEF_HFR_SIZES:{ default_sizes_tbl_t *tbl = (default_sizes_tbl_t*)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_DEF_HFR_SIZES, sizeof(struct camera_size_type)*tbl->tbl_size, tbl->sizes_tbl); } case MM_CAMERA_PARM_OP_MODE: *((mm_camera_op_mode_type_t *)parm->p_value) = my_obj->op_mode; break; case MM_CAMERA_PARM_SNAPSHOT_BURST_NUM: *((int *)parm->p_value) = my_obj->snap_burst_num_by_user; break; case MM_CAMERA_PARM_VFE_OUTPUT_ENABLE: *((int *)parm->p_value) = my_obj->properties.vfe_output_enable; break; case MM_CAMERA_PARM_LUX_IDX: CDBG("%s: MM_CAMERA_PARM_LUX_IDX\n", __func__); return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_LUX_IDX, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_MAX_NUM_FACES_DECT: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_MAX_NUM_FACES_DECT, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_FACIAL_FEATURE_INFO: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_FACIAL_FEATURE_INFO, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_HDR: rc = mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_HDR, sizeof(exp_bracketing_t), (void *)parm->p_value); //my_obj->channel_interface_mask = *((exp_bracketing_t *)(parm->p_value)); break; case MM_CAMERA_GET_PARM_LOW_LIGHT_FOR_ZSL: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_LOW_LIGHT_FOR_ZSL, sizeof(aec_info_for_flash_t), (void *)parm->p_value); case MM_CAMERA_PARM_GET_AF_STATUS: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_AF_STATUS, sizeof(af_actuator_status_t), (void *)parm->p_value); case MM_CAMERA_PARM_F_NUMBER: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_F_NUMBER, sizeof(float), (void *)parm->p_value); default: /* needs to add more implementation */ rc = -1; break; } return rc; }
void mm_camera_ch_release(mm_camera_obj_t *my_obj, mm_camera_channel_type_t ch_type) { mm_camera_ch_fn(my_obj,ch_type, MM_CAMERA_STATE_EVT_RELEASE, 0); }
int32_t mm_camera_ch_acquire(mm_camera_obj_t *my_obj, mm_camera_channel_type_t ch_type) { return mm_camera_ch_fn(my_obj,ch_type, MM_CAMERA_STATE_EVT_ACQUIRE, 0); }
int32_t mm_camera_action_start(mm_camera_obj_t *my_obj, mm_camera_ops_type_t opcode, void *parm) { int32_t rc = -MM_CAMERA_E_GENERAL; mm_camera_channel_type_t ch_type; if(opcode == MM_CAMERA_OPS_FOCUS) { if(!parm) return rc; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_SET_PARM_AUTO_FOCUS, sizeof(isp3a_af_mode_t), parm); /*return mm_camera_util_s_ctrl(my_obj->ctrl_fd, MSM_V4L2_PID_FOCUS_MODE, *((isp3a_af_mode_t *)parm));*/ } ch_type = mm_camera_util_opcode_2_ch_type(my_obj, opcode); CDBG("%s:ch=%d,op_mode=%d,opcode=%d\n", __func__,ch_type,my_obj->op_mode,opcode); switch(my_obj->op_mode) { case MM_CAMERA_OP_MODE_CAPTURE: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_SNAPSHOT: case MM_CAMERA_OPS_RAW: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_ON, NULL); break; case MM_CAMERA_OPS_PREPARE_SNAPSHOT: /* TBD: do g_ext_ctrl */ rc = MM_CAMERA_OK; break; default: break; } break; case MM_CAMERA_OP_MODE_VIDEO: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_VIDEO: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_ON, NULL); CDBG("%s: op_mode=%d, ch %d, rc=%d\n", __func__, MM_CAMERA_OP_MODE_VIDEO, ch_type ,rc); break; default: break; } break; case MM_CAMERA_OP_MODE_ZSL: switch(opcode) { case MM_CAMERA_OPS_PREVIEW: case MM_CAMERA_OPS_ZSL: rc = mm_camera_ch_fn(my_obj, ch_type, MM_CAMERA_STATE_EVT_STREAM_ON, NULL); break; default: break; } break; default: break; } return rc; }
int32_t mm_camera_get_parm(mm_camera_obj_t * my_obj, mm_camera_parm_t *parm) { int32_t rc = MM_CAMERA_OK; switch(parm->parm_type) { case MM_CAMERA_PARM_CROP: return rc = mm_camera_ch_fn(my_obj, ((mm_camera_ch_crop_t *)parm->p_value)->ch_type, MM_CAMERA_STATE_EVT_GET_CROP, parm->p_value); break; case MM_CAMERA_PARM_DIMENSION: memcpy(parm->p_value, &my_obj->dim, sizeof(my_obj->dim)); CDBG("%s: dw=%d,dh=%d,vw=%d,vh=%d,pw=%d,ph=%d,tw=%d,th=%d,ovx=%x,ovy=%d,opx=%d,opy=%d, m_fmt=%d, t_ftm=%d\n", __func__, my_obj->dim.display_width,my_obj->dim.display_height, my_obj->dim.video_width,my_obj->dim.video_height, my_obj->dim.picture_width,my_obj->dim.picture_height, my_obj->dim.ui_thumbnail_width,my_obj->dim.ui_thumbnail_height, my_obj->dim.orig_video_width,my_obj->dim.orig_video_height, my_obj->dim.orig_picture_width,my_obj->dim.orig_picture_height, my_obj->dim.main_img_format, my_obj->dim.thumb_format); break; case MM_CAMERA_PARM_MAX_PICTURE_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_pict_height; dim->width = my_obj->properties.max_pict_width; CDBG("%s: Max Picture Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_MAX_PREVIEW_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_preview_height; dim->width = my_obj->properties.max_preview_width; CDBG("%s: Max Preview Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_MAX_VIDEO_SIZE: { mm_camera_dimension_t *dim = (mm_camera_dimension_t *)parm->p_value; dim->height = my_obj->properties.max_video_height; dim->width = my_obj->properties.max_video_width; CDBG("%s: Max Video Size: %d X %d\n", __func__, dim->width, dim->height); } break; case MM_CAMERA_PARM_MAX_HFR_MODE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_MAX_HFR_MODE, sizeof(camera_hfr_mode_t), (void *)parm->p_value); case MM_CAMERA_PARM_FOCAL_LENGTH: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_FOCAL_LENGTH, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_HORIZONTAL_VIEW_ANGLE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_HORIZONTAL_VIEW_ANGLE, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_VERTICAL_VIEW_ANGLE: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_VERTICAL_VIEW_ANGLE, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_FOCUS_DISTANCES: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_FOCUS_DISTANCES, sizeof(focus_distances_info_t), (void *)parm->p_value); case MM_CAMERA_PARM_QUERY_FALSH4SNAP: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_QUERY_FLASH_FOR_SNAPSHOT, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_3D_FRAME_FORMAT: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_3D_FRAME_FORMAT, sizeof(camera_3d_frame_t), (void *)parm->p_value); case MM_CAMERA_PARM_MAXZOOM: return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_MAXZOOM, sizeof(int), (void *)parm->p_value); case MM_CAMERA_PARM_ZOOM_RATIO: { mm_camera_zoom_tbl_t *tbl = (mm_camera_zoom_tbl_t *)parm->p_value; return mm_camera_send_native_ctrl_cmd(my_obj, CAMERA_GET_PARM_ZOOMRATIOS, sizeof(int16_t)*tbl->size, tbl->zoom_ratio_tbl); } case MM_CAMERA_PARM_OP_MODE: *((mm_camera_op_mode_type_t *)parm->p_value) = my_obj->op_mode; break; case MM_CAMERA_PARM_SNAPSHOT_BURST_NUM: *((int *)parm->p_value) = my_obj->snap_burst_num_by_user; break; default: /* needs to add more implementation */ rc = -1; break; } return rc; }