summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiyong.min <jiyong.min@samsung.com>2020-04-16 07:05:30 (GMT)
committerjiyong.min <jiyong.min@samsung.com>2020-04-16 08:43:08 (GMT)
commit24233670e8d5fa877de71b0a85a4ef09eeaa9df9 (patch)
treeb4b0b49dbda7d51092822bddf20aa6402a0ab7af
parent7080a0ebd6bd64e49661e851902ea0312e3d480a (diff)
downloadlibmedia-thumbnail-24233670e8d5fa877de71b0a85a4ef09eeaa9df9.zip
libmedia-thumbnail-24233670e8d5fa877de71b0a85a4ef09eeaa9df9.tar.gz
libmedia-thumbnail-24233670e8d5fa877de71b0a85a4ef09eeaa9df9.tar.bz2
Change resize function to create rotated thumbnailsubmit/tizen/20200416.091150refs/changes/46/230946/3
Change-Id: I038c0048cd6277489dc89320848203fb2a2476cf
-rwxr-xr-xinclude/media-thumbnail.h2
-rwxr-xr-xserver/thumb-server-internal.c2
-rwxr-xr-xsrc/media-thumbnail.c7
3 files changed, 7 insertions, 4 deletions
diff --git a/include/media-thumbnail.h b/include/media-thumbnail.h
index 2022138..b35426a 100755
--- a/include/media-thumbnail.h
+++ b/include/media-thumbnail.h
@@ -45,7 +45,7 @@ int thumbnail_request_cancel_raw_data(int request_id);
int create_video_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path, bool auto_rotate);
int create_video_thumbnail_to_buffer(const char *path, unsigned int width, unsigned int height, unsigned char **thumb_buffer, size_t *thumb_size, unsigned int *thumb_width, unsigned int *thumb_height, bool auto_rotate);
-int create_image_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path);
+int create_image_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path, bool auto_rotate);
int create_image_thumbnail_to_buffer(const char *path, unsigned int width, unsigned int height, unsigned char **thumb_buffer, size_t *thumb_size, unsigned int *thumb_width, unsigned int *thumb_height);
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index 294dc80..c3e8f9e 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -51,7 +51,7 @@ static int __thumbnail_get_data(const char *origin_path, char *thumb_path)
file_type = _media_thumb_get_file_type(origin_path);
if (file_type == THUMB_IMAGE_TYPE) {
- err = create_image_thumbnail_to_file(origin_path, CONTENT_THUMB_DEFAULT_WIDTH, CONTENT_THUMB_DEFAULT_HEIGHT, thumb_path);
+ err = create_image_thumbnail_to_file(origin_path, CONTENT_THUMB_DEFAULT_WIDTH, CONTENT_THUMB_DEFAULT_HEIGHT, thumb_path, true);
} else if (file_type == THUMB_VIDEO_TYPE) {
err = create_video_thumbnail_to_file(origin_path, CONTENT_THUMB_DEFAULT_WIDTH, CONTENT_THUMB_DEFAULT_HEIGHT, thumb_path, true);
} else {
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 46b1f21..f5d1326 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -508,7 +508,7 @@ static int __get_image_info(const char *path, unsigned int *width, unsigned int
return MS_MEDIA_ERR_NONE;
}
-int create_image_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path)
+int create_image_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path, bool auto_rotate)
{
int err = MS_MEDIA_ERR_NONE;
unsigned int image_w = 0;
@@ -526,7 +526,10 @@ int create_image_thumbnail_to_file(const char *path, unsigned int width, unsigne
//Extract thumbnail
__media_thumb_get_proper_thumb_size(image_w, image_h, &thumb_w, &thumb_h);
- err = mm_util_resize_P_P(path, thumb_w, thumb_h, thumb_path);
+ if (auto_rotate)
+ err = mm_util_resize_and_rotate_P_P(path, thumb_w, thumb_h, thumb_path);
+ else
+ err = mm_util_resize_P_P(path, thumb_w, thumb_h, thumb_path);
thumb_retvm_if(err != MM_UTIL_ERROR_NONE, MS_MEDIA_ERR_INTERNAL, "mm_util_resize_P_P failed : %d", err);
return MS_MEDIA_ERR_NONE;