Modify image-util deprecated APIs 39/161139/2 accepted/tizen/unified/20171124.064627 submit/tizen/20171123.085544
authorJeesun Kim <iamjs.kim@samsung.com>
Wed, 22 Nov 2017 01:44:05 +0000 (10:44 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Thu, 23 Nov 2017 07:33:58 +0000 (16:33 +0900)
Change-Id: I393c73c0f448b781bc7a28f4fdd6bc6b3b2cca50

utils/MsgUtilFile.cpp

index 0915819..bfc58a5 100755 (executable)
@@ -47,9 +47,13 @@ extern "C" {
 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)
+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();
 
@@ -69,7 +73,35 @@ void thumbnail_completed_cb(thumbnail_util_error_e error, const char *request_id
        MSG_DEBUG("size [%d]", thumb_size);
 
        int ret = 0;
-       ret = image_util_encode_jpeg(thumb_data, thumb_width, thumb_height, IMAGE_UTIL_COLORSPACE_BGRA8888, 100, (char *)user_data);
+       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");