/** mm_jpeg_intf_create_session:
 *
 *  Arguments:
 *    @client_hdl: client handle
 *    @p_params: encode parameters
 *    @p_session_id: session id
 *
 *  Return:
 *       0 success, failure otherwise
 *
 *  Description:
 *       Create new jpeg session
 *
 **/
static int32_t mm_jpegdec_intf_create_session(uint32_t client_hdl,
    mm_jpeg_decode_params_t *p_params,
    uint32_t *p_session_id)
{
  int32_t rc = -1;

  if (0 == client_hdl || NULL == p_params || NULL == p_session_id) {
    LOGE("invalid client_hdl or jobId");
    return rc;
  }

  pthread_mutex_lock(&g_dec_intf_lock);
  if (NULL == g_jpegdec_obj) {
    /* mm_jpeg obj not exists, return error */
    LOGE("mm_jpeg is not opened yet");
    pthread_mutex_unlock(&g_dec_intf_lock);
    return rc;
  }

  rc = mm_jpegdec_create_session(g_jpegdec_obj, client_hdl, p_params, p_session_id);
  pthread_mutex_unlock(&g_dec_intf_lock);
  return rc;
}
/** mm_jpeg_intf_create_session:
 *
 *  Arguments:
 *    @client_hdl: client handle
 *    @p_params: encode parameters
 *    @p_session_id: session id
 *
 *  Return:
 *       0 success, failure otherwise
 *
 *  Description:
 *       Create new jpeg session
 *
 **/
static int32_t mm_jpegdec_intf_create_session(uint32_t client_hdl,
    mm_jpeg_decode_params_t *p_params,
    uint32_t *p_session_id)
{
  int32_t rc = -1;

  if (0 == client_hdl || NULL == p_params || NULL == p_session_id) {
    CDBG_ERROR("%s:%d] invalid client_hdl or jobId", __func__, __LINE__);
    return rc;
  }

  pthread_mutex_lock(&g_dec_intf_lock);
  if (NULL == g_jpegdec_obj) {
    /* mm_jpeg obj not exists, return error */
    CDBG_ERROR("%s:%d] mm_jpeg is not opened yet", __func__, __LINE__);
    pthread_mutex_unlock(&g_dec_intf_lock);
    return rc;
  }

  rc = mm_jpegdec_create_session(g_jpegdec_obj, client_hdl, p_params, p_session_id);
  pthread_mutex_unlock(&g_dec_intf_lock);
  return rc;
}