コード例 #1
0
int mm_app_take_live_snapshot(int cam_id)
{
    int rc = 0;
    int stream[3];
    mm_camera_bundle_attr_t attr;

    mm_camera_app_obj_t *pme = mm_app_get_cam_obj(cam_id);

    CDBG("%s:BEGIN, cam_id=%d\n",__func__,cam_id);

    if (pme->cam_mode == RECORDER_MODE &&
            pme->cam_state == CAMERA_STATE_RECORD) {
        //Code to get live shot
        if (mm_app_prepare_live_snapshot(cam_id) != MM_CAMERA_OK) {
            CDBG_ERROR("%s: Failed prepare liveshot",__func__);
            return -1;
        }
        if (MM_CAMERA_OK != (rc =pme->cam->ops->request_super_buf(pme->cam->camera_handle,pme->ch_id, 1))) {
            CDBG_ERROR("%s:request_super_buf err=%d\n", __func__, rc);
            return -1;
        }
        CDBG("%s:waiting images\n",__func__);
        mm_app_snapshot_wait(cam_id);

        if (MM_CAMERA_OK !=mm_app_unprepare_live_snapshot(cam_id)) {
            CDBG_ERROR("%s: Snapshot Stop error",__func__);
        }

    } else {
        CDBG_ERROR("%s: Should not come here for liveshot",__func__);
    }
    return rc;
}
コード例 #2
0
int mm_app_take_picture_raw(int cam_id)
{

    int rc;
    mm_camera_app_obj_t *pme = mm_app_get_cam_obj(cam_id);

    CDBG("%s:BEGIN, cam_id=%d\n",__func__,cam_id);

    if (MM_CAMERA_OK != mm_app_start_raw(cam_id)) {
        CDBG_ERROR("%s: cam_id=%d\n",__func__,cam_id);
        rc = -1;
        goto end;
    }

    CDBG("%s:waiting images\n",__func__);
    mm_app_snapshot_wait(cam_id);

    if (MM_CAMERA_OK !=mm_app_stop_raw(cam_id)) {
        CDBG_ERROR("%s: Snapshot Stop error",__func__);
    }

preview:
    if (MM_CAMERA_OK != (rc = mm_app_start_preview(cam_id))) {
        CDBG("%s:preview start stream err=%d\n", __func__, rc);
    }
end:
    CDBG("%s:END, cam_id=%d\n",__func__,cam_id);
    return rc;
}
コード例 #3
0
int mm_app_take_raw_picture(int cam_id)
{
    int rc;
#if 0
    mm_camera_app_obj_t *pme = mm_app_get_cam_obj(cam_id);

    CDBG("%s:BEGIN, cam_id=%d\n",__func__,cam_id);
    g_status = FALSE;
    if (MM_CAMERA_OK != (rc = pme->cam->ops->action(pme->cam, TRUE, MM_CAMERA_OPS_PREPARE_SNAPSHOT, 0))) {
        CDBG("%s:prepare snapshot err=%d\n", __func__, rc);
        goto end;
    }
    if (MM_CAMERA_OK != (rc = mm_app_stop_preview(cam_id))) {
        CDBG("%s:mm_app_stop_preview err=%d\n", __func__, rc);
        goto end;
    }
    if (MM_CAMERA_OK != mm_app_start_raw_snapshot(cam_id))
        goto preview;
    CDBG("%s:waiting images\n",__func__);
    mm_app_snapshot_wait(cam_id);
    CDBG("%s:calling mm_app_stop_snapshot() \n",__func__);
    mm_app_stop_raw_snapshot(cam_id);
preview:
    mm_app_start_preview(cam_id);
end:
    CDBG("%s:END, cam_id=%d\n",__func__,cam_id);
#endif
    return rc;
}