/** mm_jpeg_intf_close: * * Arguments: * @client_hdl: client handle * * Return: * 0 success, failure otherwise * * Description: * Close the jpeg job * **/ static int32_t mm_jpeg_intf_close(uint32_t client_hdl) { int32_t rc = -1; if (0 == client_hdl) { CDBG_ERROR("%s:%d] invalid client_hdl", __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_close(g_jpeg_obj, client_hdl); g_jpeg_obj->num_clients--; if(0 == rc) { if (0 == g_jpeg_obj->num_clients) { /* No client, close jpeg internally */ rc = mm_jpeg_deinit(g_jpeg_obj); free(g_jpeg_obj); g_jpeg_obj = NULL; } } pthread_mutex_unlock(&g_intf_lock); return rc; }
/** mm_jpeg_intf_close: * * Arguments: * @client_hdl: client handle * * Return: * 0 success, failure otherwise * * Description: * Close the jpeg job * **/ static int32_t mm_jpegdec_intf_close(uint32_t client_hdl) { int32_t rc = -1; if (0 == client_hdl) { LOGE("invalid client_hdl"); 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_jpeg_close(g_jpegdec_obj, client_hdl); g_jpegdec_obj->num_clients--; if(0 == rc) { if (0 == g_jpegdec_obj->num_clients) { /* No client, close jpeg internally */ rc = mm_jpegdec_deinit(g_jpegdec_obj); free(g_jpegdec_obj); g_jpegdec_obj = NULL; } } pthread_mutex_unlock(&g_dec_intf_lock); return rc; }