summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaejeong Kim <backto.kim@samsung.com>2017-08-25 06:06:33 (GMT)
committerHaejeong Kim <backto.kim@samsung.com>2017-08-25 06:06:33 (GMT)
commit8cf4bc44c2593b47725f293a2f834eea9c994d2d (patch)
tree50718c835fae7c312351bd4d975e960a9a860a10
parenta01728d934f14df997888ea84970ab86e872e420 (diff)
downloadlibmedia-thumbnail-8cf4bc44c2593b47725f293a2f834eea9c994d2d.zip
libmedia-thumbnail-8cf4bc44c2593b47725f293a2f834eea9c994d2d.tar.gz
libmedia-thumbnail-8cf4bc44c2593b47725f293a2f834eea9c994d2d.tar.bz2
Remove dependency of mmutil-imgp. Use capi-media-image-util insteadrefs/changes/35/146135/1
Change-Id: I99067c6f27c43ae5a51fc9568e945d9502ba004c
-rwxr-xr-xCMakeLists.txt2
-rw-r--r--packaging/libmedia-thumbnail.spec2
-rwxr-xr-xserver/CMakeLists.txt2
-rwxr-xr-xsrc/codec/img-codec.c6
-rwxr-xr-xsrc/media-thumb-internal.c53
-rw-r--r--test/CMakeLists.txt2
6 files changed, 35 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09996fe..f405d5d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,7 @@ MESSAGE("Build type: ${CMAKE_BUILD_TYPE}")
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/codec ${CMAKE_SOURCE_DIR}/src/include/util ${CMAKE_SOURCE_DIR}/src/include/ipc ${CMAKE_SOURCE_DIR}/server/include ${CMAKE_SOURCE_DIR}/md5)
INCLUDE(FindPkgConfig)
- pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog sqlite3 mm-fileinfo aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils libtzplatform-config db-util)
+ pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog sqlite3 mm-fileinfo aul libexif ecore-evas evas capi-media-image-util mmutil-jpeg libmedia-utils libtzplatform-config db-util)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec
index 434708a..d2c53e4 100644
--- a/packaging/libmedia-thumbnail.spec
+++ b/packaging/libmedia-thumbnail.spec
@@ -13,7 +13,7 @@ Requires: media-server
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(mm-fileinfo)
-BuildRequires: pkgconfig(mmutil-imgp)
+BuildRequires: pkgconfig(capi-media-image-util)
BuildRequires: pkgconfig(mmutil-jpeg)
BuildRequires: pkgconfig(libexif)
BuildRequires: pkgconfig(evas)
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index fee6e02..1493bb5 100755
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -5,7 +5,7 @@ SET(THUMB-SERVER
thumb-server-internal.c)
INCLUDE(FindPkgConfig)
- pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils libtzplatform-config)
+ pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif ecore-evas evas mmutil-jpeg libmedia-utils libtzplatform-config)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
diff --git a/src/codec/img-codec.c b/src/codec/img-codec.c
index e37ab8b..e87e93f 100755
--- a/src/codec/img-codec.c
+++ b/src/codec/img-codec.c
@@ -22,7 +22,7 @@
#include "media-thumb-debug.h"
#include "img-codec.h"
#include <string.h>
-#include <mm_util_imgp.h>
+#include <image_util.h>
unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
unsigned int width, unsigned int height)
@@ -54,7 +54,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
unsigned int i = 0;
- if (mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, width, height, &i) < 0) {
+ if (image_util_calculate_buffer_size(width, height, IMAGE_UTIL_COLORSPACE_RGB888, &i) < 0) {
thumb_err("ImgGetFirstFrameAGIFAtSize: Failed to get buffer size");
return NULL;
}
@@ -101,7 +101,7 @@ int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, i
return FALSE;
}
- if (mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, width, height, &size) < 0) {
+ if (image_util_calculate_buffer_size(width, height, IMAGE_UTIL_COLORSPACE_RGB888, &size) < 0) {
thumb_err("ImgGetFirstFrameAGIFAtSize: Failed to get buffer size");
return FALSE;
}
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);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ea47e5c..20f7d4e 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,7 +1,7 @@
SET(TEST-THUMB "test-thumb.c")
INCLUDE(FindPkgConfig)
- pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg libmedia-utils libtzplatform-config)
+ pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 dlog mm-fileinfo aul libexif ecore-evas evas mmutil-jpeg libmedia-utils libtzplatform-config)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")