/** mm_jpeg_intf_start_job:
 *
 *  Arguments:
 *    @client_hdl: client handle
 *    @job: jpeg job object
 *    @jobId: job id
 *
 *  Return:
 *       0 success, failure otherwise
 *
 *  Description:
 *       start the jpeg job
 *
 **/
static int32_t mm_jpeg_intf_start_job(mm_jpeg_job_t* job, uint32_t* job_id)
{
  int32_t rc = -1;

  if (NULL == job ||
    NULL == job_id) {
    CDBG_ERROR("%s:%d] invalid parameters for job or jobId", __func__, __LINE__);
    return rc;
  }

  pthread_mutex_lock(&g_intf_lock);
  if (NULL == g_jpeg_obj) {
    /* mm_jpeg obj not exists, return error */
    CDBG_ERROR("%s:%d] mm_jpeg is not opened yet", __func__, __LINE__);
    pthread_mutex_unlock(&g_intf_lock);
    return rc;
  }
  rc = mm_jpeg_start_job(g_jpeg_obj, job, job_id);
  pthread_mutex_unlock(&g_intf_lock);
  return rc;
}
static int32_t mm_jpeg_intf_start_job(uint32_t client_hdl, mm_jpeg_job* job, uint32_t* jobId)
{
    int32_t rc = -1;

    if (0 == client_hdl ||
        NULL == job ||
        NULL == jobId) {
        CDBG_ERROR("%s: invalid parameters for client_hdl, job or jobId", __func__);
        return rc;
    }

    pthread_mutex_lock(&g_intf_lock);
    if (NULL == g_jpeg_obj) {
        /* mm_jpeg obj not exists, return error */
        CDBG_ERROR("%s: mm_jpeg is not opened yet", __func__);
        pthread_mutex_unlock(&g_intf_lock);
        return rc;
    }
    mm_jpeg_dump_job(job);
    rc = mm_jpeg_start_job(g_jpeg_obj, client_hdl, job, jobId);
    pthread_mutex_unlock(&g_intf_lock);
    return rc;
}