diff options
Diffstat (limited to 'src/media-thumb-internal.c')
-rwxr-xr-x | src/media-thumb-internal.c | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 155cd5f..1f09570 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -38,8 +38,8 @@ #include <unistd.h> #include <mm_file.h> -#include <mm_util_imgp.h> #include <mm_util_jpeg.h> +#include <image_util.h> #include <Evas.h> #include <Ecore_Evas.h> #include <libexif/exif-data.h> @@ -47,10 +47,13 @@ #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) +static int __media_thumb_get_buffer_size(image_util_colorspace_e 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"); + int err = IMAGE_UTIL_ERROR_NONE; + + err = image_util_calculate_buffer_size(width, height, format, imgsize); + if (err != IMAGE_UTIL_ERROR_NONE) { + thumb_err("image_util_calculate_buffer_size failed"); return MS_MEDIA_ERR_INTERNAL; } @@ -66,7 +69,7 @@ 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 (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, width, height, buf_size) < 0) { + if (__media_thumb_get_buffer_size(IMAGE_UTIL_COLORSPACE_BGRA8888, width, height, buf_size) < 0) { thumb_err("__media_thumb_get_buffer_size failed"); return MS_MEDIA_ERR_INTERNAL; } @@ -171,7 +174,7 @@ 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 (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + if (__media_thumb_get_buffer_size(IMAGE_UTIL_COLORSPACE_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { thumb_err("__media_thumb_get_buffer_size failed"); ecore_evas_free(resize_img_ee); @@ -259,11 +262,11 @@ int _media_thumb_rotate_thumb(unsigned char *data, int size, int *width, int *he int err = MS_MEDIA_ERR_NONE; int i = 0, count = 0; - if (orientation == MM_UTIL_ROTATE_90) { + if (orientation == IMAGE_UTIL_ROTATION_90) { count = 1; - } else if (orientation == MM_UTIL_ROTATE_180) { + } else if (orientation == IMAGE_UTIL_ROTATION_180) { count = 2; - } else if (orientation == MM_UTIL_ROTATE_270) { + } else if (orientation == IMAGE_UTIL_ROTATION_270) { count = 3; } @@ -533,13 +536,13 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed, thumb_width = decoded.width; thumb_height = decoded.height; - int rot_type = MM_UTIL_ROTATE_0; + int rot_type = IMAGE_UTIL_ROTATION_NONE; if (orientation == ROT_90) { - rot_type = MM_UTIL_ROTATE_90; + rot_type = IMAGE_UTIL_ROTATION_90; } else if (orientation == ROT_180) { - rot_type = MM_UTIL_ROTATE_180; + rot_type = IMAGE_UTIL_ROTATION_180; } else if (orientation == ROT_270) { - rot_type = MM_UTIL_ROTATE_270; + rot_type = IMAGE_UTIL_ROTATION_270; } err = _media_thumb_rotate_thumb(decoded.data, decoded.size, &(decoded.width), &(decoded.height), rot_type, MM_UTIL_JPEG_FMT_RGB888); if (err != MS_MEDIA_ERR_NONE) { @@ -727,7 +730,7 @@ 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 (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + if (__media_thumb_get_buffer_size(IMAGE_UTIL_COLORSPACE_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { thumb_err("__media_thumb_get_buffer_size failed"); ecore_evas_free(resize_img_ee); @@ -770,7 +773,7 @@ int _media_thumb_convert_data(media_thumb_info *thumb_info, int thumb_width, int unsigned char *dst_data = NULL; int i = 0, j; - if (__media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { + if (__media_thumb_get_buffer_size(IMAGE_UTIL_COLORSPACE_BGRA8888, thumb_width, thumb_height, &buf_size) < 0) { thumb_err("__media_thumb_get_buffer_size failed"); return MS_MEDIA_ERR_INTERNAL; } @@ -813,7 +816,7 @@ int _media_thumb_agif(const char *origin_path, int thumb_width, int thumb_height return MS_MEDIA_ERR_INTERNAL; } - err = __media_thumb_get_buffer_size(MM_UTIL_IMG_FMT_RGB888, thumb_info->origin_width, thumb_info->origin_height, &thumb_size); + err = __media_thumb_get_buffer_size(IMAGE_UTIL_COLORSPACE_RGB888, thumb_info->origin_width, thumb_info->origin_height, &thumb_size); if (err != MS_MEDIA_ERR_NONE) { thumb_err("__media_thumb_get_buffer_size failed: %d", err); SAFE_FREE(thumb); @@ -986,28 +989,28 @@ int _media_thumb_video(const char *origin_path, int thumb_width, int thumb_heigh char *p = NULL; int cdis_value = 0; err = mm_file_create_tag_attrs(&tag, origin_path); - mm_util_img_rotate_type rot_type = MM_UTIL_ROTATE_0; + image_util_rotation_e rot_type = IMAGE_UTIL_ROTATION_NONE; if (err == FILEINFO_ERROR_NONE) { err = mm_file_get_attrs(tag, &err_msg, MM_FILE_TAG_ROTATE, &p, &size, NULL); if (err == FILEINFO_ERROR_NONE && size >= 0) { if (p == NULL) { - rot_type = MM_UTIL_ROTATE_0; + rot_type = IMAGE_UTIL_ROTATION_NONE; } else { if (strncmp(p, "90", size) == 0) { - rot_type = MM_UTIL_ROTATE_90; + rot_type = IMAGE_UTIL_ROTATION_90; } else if (strncmp(p, "180", size) == 0) { - rot_type = MM_UTIL_ROTATE_180; + rot_type = IMAGE_UTIL_ROTATION_180; } else if (strncmp(p, "270", size) == 0) { - rot_type = MM_UTIL_ROTATE_270; + rot_type = IMAGE_UTIL_ROTATION_270; } else { - rot_type = MM_UTIL_ROTATE_0; + rot_type = IMAGE_UTIL_ROTATION_NONE; } } thumb_dbg("There is tag rotate : %d", rot_type); } else { thumb_dbg("There is NOT tag rotate"); - rot_type = MM_UTIL_ROTATE_0; + rot_type = IMAGE_UTIL_ROTATION_NONE; SAFE_FREE(err_msg); } @@ -1018,7 +1021,7 @@ int _media_thumb_video(const char *origin_path, int thumb_width, int thumb_heigh } } else { - rot_type = MM_UTIL_ROTATE_0; + rot_type = IMAGE_UTIL_ROTATION_NONE; cdis_value = 0; } @@ -1114,7 +1117,7 @@ int _media_thumb_video(const char *origin_path, int thumb_width, int thumb_heigh } SAFE_FREE(new_frame); - if (rot_type == MM_UTIL_ROTATE_90 || rot_type == MM_UTIL_ROTATE_180 || rot_type == MM_UTIL_ROTATE_270) { + if (rot_type == IMAGE_UTIL_ROTATION_90 || rot_type == IMAGE_UTIL_ROTATION_180 || rot_type == IMAGE_UTIL_ROTATION_270) { err = _media_thumb_rotate_thumb(thumb_info->data, thumb_info->size, &(thumb_info->width), &(thumb_info->height), rot_type, MM_UTIL_JPEG_FMT_BGRA8888); if (err != MS_MEDIA_ERR_NONE) { thumb_err("_media_thumb_rotate_thumb falied: %d", err); |