int mm_app_tc_capture_burst(mm_camera_app_t *cam_app)
{
    int rc = MM_CAMERA_OK;
    int i, j;
    mm_camera_test_obj_t test_obj;
    uint8_t num_snapshot = 3;
    uint8_t num_rcvd_snapshot = 0;

    printf("\n Verifying capture...\n");
    for (i = 0; i < cam_app->num_cameras; i++) {
        memset(&test_obj, 0, sizeof(mm_camera_test_obj_t));
        rc = mm_app_open(cam_app, i, &test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_open() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            break;
        }

        for (j = 0; j < MM_QCAMERA_APP_UTEST_INNER_LOOP; j++) {
            rc = mm_app_start_capture(&test_obj, num_snapshot);
            if (rc != MM_CAMERA_OK) {
                CDBG_ERROR("%s: mm_app_start_capture() cam_idx=%d, err=%d\n",
                           __func__, i, rc);
                break;
            }
            while (num_rcvd_snapshot < num_snapshot) {
                mm_camera_app_wait();
                num_rcvd_snapshot++;
            }
            rc = mm_app_stop_capture(&test_obj);
            if (rc != MM_CAMERA_OK) {
                CDBG_ERROR("%s: mm_app_stop_capture() cam_idx=%d, err=%d\n",
                           __func__, i, rc);
                break;
            }
        }

        rc = mm_app_close(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_close() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            break;
        }
    }
    if (rc == MM_CAMERA_OK) {
        printf("\nPassed\n");
    } else {
        printf("\nFailed\n");
    }
    CDBG("%s:END, rc = %d\n", __func__, rc);
    return rc;
}
int mm_app_take_picture(mm_camera_test_obj_t *test_obj, uint8_t is_burst_mode)
{
    LOGH("\nEnter %s!!\n");
    int rc = MM_CAMERA_OK;
    uint8_t num_snapshot = 1;
    int num_rcvd_snapshot = 0;

    if (is_burst_mode)
       num_snapshot = 6;

    //stop preview before starting capture.
    rc = mm_app_stop_preview(test_obj);
    if (rc != MM_CAMERA_OK) {
        LOGE(" stop preview failed before capture!!, err=%d\n", rc);
        return rc;
    }

    rc = mm_app_start_capture(test_obj, num_snapshot);
    if (rc != MM_CAMERA_OK) {
        LOGE(" mm_app_start_capture(), err=%d\n", rc);
        return rc;
    }
    while (num_rcvd_snapshot < num_snapshot) {
        LOGH("\nWaiting mm_camera_app_wait !!\n");
        mm_camera_app_wait();
        num_rcvd_snapshot++;
    }
    rc = mm_app_stop_capture(test_obj);
    if (rc != MM_CAMERA_OK) {
       LOGE(" mm_app_stop_capture(), err=%d\n", rc);
       return rc;
    }
    //start preview after capture.
    rc = mm_app_start_preview(test_obj);
    if (rc != MM_CAMERA_OK) {
        LOGE(" start preview failed after capture!!, err=%d\n",rc);
    }
    return rc;
}
int takePicture_rdi(int cam_id)
{
    int rc = MM_CAMERA_OK;
    mm_camera_app_obj_t *pme = mm_app_get_cam_obj(cam_id);

    mm_app_streamoff_rdi(cam_id);
    rdi_op_mode = MM_CAMERA_OP_MODE_CAPTURE;
    mm_app_set_opmode(cam_id, MM_CAMERA_OP_MODE_CAPTURE);
    if (MM_CAMERA_OK != (rc = mm_app_prepare_rdi(cam_id, 1))) {
        CDBG_ERROR("%s:Prepare RDI failed rc=%d\n", __func__, rc);
        goto end;
    }
    if (MM_CAMERA_OK != (rc = mm_app_streamon_rdi(cam_id))) {
        CDBG_ERROR("%s:Stream On RDI failed rc=%d\n", __func__, rc);
        goto end;
    }
    mm_camera_app_wait(cam_id);
    usleep(50*1000);
    mm_app_streamoff_rdi(cam_id);
    mm_app_start_rdi(cam_id);
end:
    return rc;
}
int mm_app_tc_start_stop_live_snapshot(mm_camera_app_t *cam_app)
{
    int rc = MM_CAMERA_OK;
    int i, j;
    mm_camera_test_obj_t test_obj;

    printf("\n Verifying start/stop live snapshot...\n");
    for (i = 0; i < cam_app->num_cameras; i++) {
        memset(&test_obj, 0, sizeof(mm_camera_test_obj_t));
        rc = mm_app_open(cam_app, i, &test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_open() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            break;
        }

        rc = mm_app_start_record_preview(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_start_record_preview() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            mm_app_close(&test_obj);
            break;
        }

        sleep(1);

        rc = mm_app_start_record(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_start_record() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            mm_app_stop_record_preview(&test_obj);
            mm_app_close(&test_obj);
            break;
        }

        sleep(1);

        for (j = 0; j < MM_QCAMERA_APP_UTEST_INNER_LOOP; j++) {
            rc = mm_app_start_live_snapshot(&test_obj);
            if (rc != MM_CAMERA_OK) {
                CDBG_ERROR("%s:mm_app_start_live_snapshot() cam_idx=%d, err=%d\n",
                           __func__, i, rc);
                break;
            }

            /* wait for jpeg is done */
            mm_camera_app_wait();

            rc = mm_app_stop_live_snapshot(&test_obj);
            if (rc != MM_CAMERA_OK) {
                CDBG_ERROR("%s:mm_app_stop_live_snapshot() cam_idx=%d, err=%d\n",
                           __func__, i, rc);
                break;
            }
        }
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:start/stop live snapshot cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            mm_app_stop_record(&test_obj);
            mm_app_stop_record_preview(&test_obj);
            mm_app_close(&test_obj);
            break;
        }

        rc = mm_app_stop_record(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_stop_record() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            mm_app_stop_record_preview(&test_obj);
            mm_app_close(&test_obj);
            break;
        }

        sleep(1);

        rc = mm_app_stop_record_preview(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_stop_record_preview() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            mm_app_close(&test_obj);
            break;
        }

        rc = mm_app_close(&test_obj);
        if (rc != MM_CAMERA_OK) {
            CDBG_ERROR("%s:mm_app_close() cam_idx=%d, err=%d\n",
                       __func__, i, rc);
            break;
        }
    }
    if (rc == MM_CAMERA_OK) {
        printf("\nPassed\n");
    } else {
        printf("\nFailed\n");
    }
    CDBG("%s:END, rc = %d\n", __func__, rc);
    return rc;
}