示例#1
0
int32_t mm_camera_ch_fn(mm_camera_obj_t * my_obj, 
																	mm_camera_channel_type_t ch_type, 
																	mm_camera_state_evt_type_t evt, void *val)
{
	int32_t rc = MM_CAMERA_OK;

	CDBG("%s:ch = %d, evt=%d\n", __func__, ch_type, evt);
	switch(evt) {
	case MM_CAMERA_STATE_EVT_ACQUIRE:
		rc = mm_camera_ch_util_acquire(my_obj, ch_type);
		break;
	case MM_CAMERA_STATE_EVT_RELEASE:
		rc = mm_camera_ch_util_release(my_obj, ch_type, evt);
		break;
	case MM_CAMERA_STATE_EVT_ATTR:
		rc = mm_camera_ch_util_attr(my_obj, ch_type, 
																(mm_camera_channel_attr_t *)val);
		break;
	case MM_CAMERA_STATE_EVT_REG_BUF_CB:
		rc = mm_camera_ch_util_reg_buf_cb(my_obj, ch_type, 
																			(mm_camera_buf_cb_t *)val);
		break;
	case MM_CAMERA_STATE_EVT_SET_FMT:
		rc = mm_camera_ch_util_set_fmt(my_obj, ch_type, 
														(mm_camera_ch_image_fmt_parm_t *)val);
		break;
	case MM_CAMERA_STATE_EVT_REG_BUF:
		rc = mm_camera_ch_util_reg_buf(my_obj, ch_type, evt, val);
		break;
	case MM_CAMERA_STATE_EVT_UNREG_BUF:
		rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
		break;
	case MM_CAMERA_STATE_EVT_STREAM_ON:
		if(ch_type == MM_CAMERA_CH_RAW && 
			 my_obj->ch[ch_type].raw.mode == MM_CAMERA_RAW_STREAMING_CAPTURE_SINGLE) {
			if( MM_CAMERA_OK != (rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd, 
				MSM_V4L2_PID_CAM_MODE, MSM_V4L2_CAM_OP_RAW))) {
				CDBG("%s:set MM_CAMERA_RAW_STREAMING_CAPTURE_SINGLE err=%d\n", __func__, rc);
				break;
			}
		}
		rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
		break;
	case MM_CAMERA_STATE_EVT_STREAM_OFF:
		rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
		break;
	case MM_CAMERA_STATE_EVT_QBUF:
		rc = mm_camera_ch_util_qbuf(my_obj, ch_type, evt, 
																(mm_camera_ch_data_buf_t *)val);
		break;
	default:
		break;
	}
	return rc;
}
示例#2
0
int32_t mm_camera_ch_fn(mm_camera_obj_t * my_obj,
        mm_camera_channel_type_t ch_type,
        mm_camera_state_evt_type_t evt, void *val)
{
    int32_t rc = MM_CAMERA_OK;

    CDBG("%s:ch = %d, evt=%d\n", __func__, ch_type, evt);
    switch(evt) {
    case MM_CAMERA_STATE_EVT_ACQUIRE:
        rc = mm_camera_ch_util_acquire(my_obj, ch_type);
        break;
    case MM_CAMERA_STATE_EVT_RELEASE:
      /* safe code in case no stream off before release. */
        //mm_camera_poll_thread_release(my_obj, ch_type);
        rc = mm_camera_ch_util_release(my_obj, ch_type, evt);
        break;
    case MM_CAMERA_STATE_EVT_ATTR:
        rc = mm_camera_ch_util_attr(my_obj, ch_type,
                                    (mm_camera_channel_attr_t *)val);
        break;
    case MM_CAMERA_STATE_EVT_REG_BUF_CB:
        rc = mm_camera_ch_util_reg_buf_cb(my_obj, ch_type,
                                          (mm_camera_buf_cb_t *)val);
        break;
    case MM_CAMERA_STATE_EVT_SET_FMT:
        rc = mm_camera_ch_util_set_fmt(my_obj, ch_type,
                                       (mm_camera_ch_image_fmt_parm_t *)val);
        break;
    case MM_CAMERA_STATE_EVT_REG_BUF:
    case MM_CAMERA_STATE_EVT_REQUEST_BUF:
    case MM_CAMERA_STATE_EVT_ENQUEUE_BUF:
        rc = mm_camera_ch_util_reg_buf(my_obj, ch_type, evt, val);
        break;
    case MM_CAMERA_STATE_EVT_UNREG_BUF:
        rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
        break;
    case MM_CAMERA_STATE_EVT_STREAM_ON: {
        if(ch_type == MM_CAMERA_CH_RAW &&
             my_obj->ch[ch_type].raw.mode == MM_CAMERA_RAW_STREAMING_CAPTURE_SINGLE) {
            if( MM_CAMERA_OK != (rc = mm_camera_util_s_ctrl(my_obj->ctrl_fd,
                MSM_V4L2_PID_CAM_MODE, MSM_V4L2_CAM_OP_RAW))) {
                CDBG("%s:set MM_CAMERA_RAW_STREAMING_CAPTURE_SINGLE err=%d\n", __func__, rc);
                break;
            }
        }
        mm_camera_poll_thread_add_ch(my_obj, ch_type);
        rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
        if(rc < 0) {
          CDBG_ERROR("%s: Failed in STREAM ON", __func__);
          mm_camera_poll_thread_release(my_obj, ch_type);
        }
        break;
    }
    case MM_CAMERA_STATE_EVT_STREAM_OFF: {
        mm_camera_poll_thread_del_ch(my_obj, ch_type);
        rc = mm_camera_ch_util_stream_null_val(my_obj, ch_type, evt, NULL);
        break;
    }
    case MM_CAMERA_STATE_EVT_QBUF:
        rc = mm_camera_ch_util_qbuf(my_obj, ch_type, evt,
                                    (mm_camera_ch_data_buf_t *)val);
        break;
    case MM_CAMERA_STATE_EVT_GET_CROP:
      rc = mm_camera_ch_util_get_crop(my_obj, ch_type, evt,
                                  (mm_camera_ch_crop_t *)val);
      break;
    case MM_CAMERA_STATE_EVT_DISPATCH_BUFFERED_FRAME:
      rc = mm_camera_ch_util_dispatch_buffered_frame(my_obj, ch_type);
      break;
    default:
        break;
    }
    return rc;
}