From: Krishna Kant Jaju Date: Fri, 10 Feb 2023 04:03:21 +0000 (+0530) Subject: Changed the deprecated thumbnail_util APIs in msg-service X-Git-Tag: accepted/tizen/unified/20230220.174436^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fmessaging%2Fmsg-service.git;a=commitdiff_plain;h=759afdef36955118bbb35491ed46fb749bdcd613 Changed the deprecated thumbnail_util APIs in msg-service Change-Id: I357b6d96a8cc212cf5bde75f96341e77ede16757 Signed-off-by: Krishna Kant Jaju --- diff --git a/utils/MsgUtilFile.cpp b/utils/MsgUtilFile.cpp index 7285d6e..9b00350 100755 --- a/utils/MsgUtilFile.cpp +++ b/utils/MsgUtilFile.cpp @@ -45,74 +45,12 @@ extern "C" { } #define PATH_LIBCSR_CLIENT "/usr/lib/libcsr-client.so.2" +#define THUMB_WIDTH 320 +#define THUMB_HEIGHT 240 MsgMutex g_mx; MsgCndVar g_cv; -void thumbnail_completed_cb(thumbnail_util_error_e error, - const char *request_id, - int thumb_width, - int thumb_height, - unsigned char *thumb_data, - int thumb_size, - void *user_data) -{ - MSG_BEGIN(); - - g_mx.lock(); - - if (!user_data) { - MSG_WARN("dstPath is NULL"); - g_cv.signal(); - g_mx.unlock(); - return; - } - - MSG_DEBUG("=================[RESULT]"); - MSG_DEBUG("error_code [%d]", error); - MSG_DEBUG("request id [%s]", request_id); - MSG_DEBUG("width [%d], height [%d]", thumb_width, thumb_height); - MSG_DEBUG("size [%d]", thumb_size); - - int ret = 0; - image_util_encode_h eh = NULL; - - do { - unsigned long long ll_size_encode = 0; - - ret = image_util_encode_create(IMAGE_UTIL_JPEG, &eh); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_set_input_buffer(eh, thumb_data); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_set_resolution(eh, thumb_width, thumb_height); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_set_colorspace(eh, IMAGE_UTIL_COLORSPACE_BGRA8888); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_set_quality(eh, 100); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_set_output_path(eh, (char *)user_data); - if (IMAGE_UTIL_ERROR_NONE != ret) - break; - ret = image_util_encode_run(eh, &ll_size_encode); - } while (0); - - if (eh) - image_util_encode_destroy(eh); - - if (ret != IMAGE_UTIL_ERROR_NONE) - MSG_WARN("image_util_encode_jpeg() is failed"); - - g_cv.signal(); - g_mx.unlock(); - - MSG_END(); -} - /*================================================================================================== FUNCTION IMPLEMENTATION ==================================================================================================*/ @@ -134,19 +72,16 @@ bool MakeThumbnail(char *srcPath, char *dstPath) int ret = THUMBNAIL_UTIL_ERROR_NONE; char *req_id = NULL; - thumbnail_h thumb_h; - thumbnail_util_create(&thumb_h); - thumbnail_util_set_path(thumb_h, srcPath); - ret = thumbnail_util_extract(thumb_h, thumbnail_completed_cb, dstPath, &req_id); - thumbnail_util_destroy(thumb_h); + ret = thumbnail_util_extract_to_file(srcPath, THUMB_WIDTH, THUMB_HEIGHT, dstPath); + if (req_id) { g_free(req_id); req_id = NULL; } if (ret != THUMBNAIL_UTIL_ERROR_NONE) { - MSG_ERR("thumbnail_util_extract is failed"); + MSG_ERR("thumbnail_util_extract_to_file is failed"); g_mx.unlock(); return false; }