From a01728d934f14df997888ea84970ab86e872e420 Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Fri, 25 Aug 2017 14:15:02 +0900 Subject: [PATCH] Make internal Api for get image size Change-Id: I007c80b154aad6e10f59bff55bf151d948ccf5a2 --- src/media-thumb-internal.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 7ecc700..155cd5f 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -47,6 +47,16 @@ #define MEDIA_THUMB_ROUND_UP_8(num) (((num)+7)&~7) +static int __media_thumb_get_buffer_size(mm_util_img_format format, unsigned int width, unsigned int height, unsigned int *imgsize) +{ + if (mm_util_get_image_size(format, width, height, imgsize) < 0) { + thumb_err("mm_util_get_image_size failed"); + return MS_MEDIA_ERR_INTERNAL; + } + + return MS_MEDIA_ERR_NONE; +} + int _media_thumb_rgb_to_argb(const unsigned char *src_data, const int src_size, unsigned char **dst_data, unsigned int *buf_size, @@ -56,12 +66,12 @@ int _media_thumb_rgb_to_argb(const unsigned char *src_data, const int src_size, int err = MS_MEDIA_ERR_NONE; int i = 0, j; - if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, width, height, buf_size) < 0) { - thumb_err("mm_util_get_image_size failed"); + if (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, width, height, buf_size) < 0) { + thumb_err("__media_thumb_get_buffer_size failed"); return MS_MEDIA_ERR_INTERNAL; } - thumb_dbg("mm_util_get_image_size : %d", *buf_size); + thumb_dbg("__media_thumb_get_buffer_size : %d", *buf_size); *dst_data = (unsigned char *)malloc(*buf_size); if (*dst_data == NULL) { @@ -161,8 +171,8 @@ int _media_thumb_resize_with_evas(const void *image, int thumb_width, int thumb_ evas_object_image_data_update_add(ret_image, 0, 0, thumb_width, thumb_height); unsigned int buf_size = 0; - if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { - thumb_err("mm_util_get_image_size failed"); + if (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + thumb_err("__media_thumb_get_buffer_size failed"); ecore_evas_free(resize_img_ee); ecore_evas_free(target_ee); @@ -717,15 +727,15 @@ int _media_thumb_decode_with_evas(const char *origin_path, evas_object_image_data_update_add(ret_image, 0, 0, thumb_width, thumb_height); unsigned int buf_size = 0; - if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { - thumb_err("mm_util_get_image_size failed"); + if (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + thumb_err("__media_thumb_get_buffer_size failed"); ecore_evas_free(resize_img_ee); ecore_evas_free(target_ee); return MS_MEDIA_ERR_INTERNAL; } - //thumb_dbg("mm_util_get_image_size : %d", buf_size); + //thumb_dbg("__media_thumb_get_buffer_size : %d", buf_size); thumb_info->size = buf_size; thumb_info->width = thumb_width; @@ -760,12 +770,12 @@ int _media_thumb_convert_data(media_thumb_info *thumb_info, int thumb_width, int unsigned char *dst_data = NULL; int i = 0, j; - if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { - thumb_err("mm_util_get_image_size failed"); + if (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + thumb_err("__media_thumb_get_buffer_size failed"); return MS_MEDIA_ERR_INTERNAL; } - thumb_dbg("mm_util_get_image_size : %d", buf_size); + thumb_dbg("__media_thumb_get_buffer_size : %d", buf_size); dst_data = (unsigned char *)malloc(buf_size); if (dst_data == NULL) { @@ -803,9 +813,9 @@ int _media_thumb_agif(const char *origin_path, int thumb_width, int thumb_height return MS_MEDIA_ERR_INTERNAL; } - err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, thumb_info->origin_width, thumb_info->origin_height, &thumb_size); + err = __media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_RGB888, thumb_info->origin_width, thumb_info->origin_height, &thumb_size); if (err != MS_MEDIA_ERR_NONE) { - thumb_err("mm_util_get_image_size failed: %d", err); + thumb_err("__media_thumb_get_buffer_size failed: %d", err); SAFE_FREE(thumb); return err; } -- 2.7.4