diff options
author | Hyunjun Ko <zzoon.ko@samsung.com> | 2012-02-10 14:43:37 +0900 |
---|---|---|
committer | Hyunjun Ko <zzoon.ko@samsung.com> | 2012-02-10 14:43:37 +0900 |
commit | 28aef6d6021b790ac6cda467936ed42082dfd8dd (patch) | |
tree | b8ab014a90bbe6386478dc331e4f0f7921e1653a | |
parent | 87d4884d38e94105cea0640175e8e70604a23638 (diff) | |
download | libmedia-thumbnail-28aef6d6021b790ac6cda467936ed42082dfd8dd.tar.gz libmedia-thumbnail-28aef6d6021b790ac6cda467936ed42082dfd8dd.tar.bz2 libmedia-thumbnail-28aef6d6021b790ac6cda467936ed42082dfd8dd.zip |
Push the laste code of libmedia-thumbnail
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | TC/tet_scen | 3 | ||||
-rw-r--r-- | TC/utc/Makefile | 12 | ||||
-rw-r--r-- | TC/utc/tslist | 4 | ||||
-rw-r--r-- | TC/utc/utc_thumbnail_request_from_db_func.c | 2 | ||||
-rw-r--r-- | TC/utc/utc_thumbnail_request_save_to_file_func.c | 90 | ||||
-rw-r--r-- | TC/utc/utc_thumbnail_request_save_to_file_func.h | 52 | ||||
-rwxr-xr-x | debian/changelog | 12 | ||||
-rwxr-xr-x | debian/control | 3 | ||||
-rwxr-xr-x | include/media-thumb-types.h | 4 | ||||
-rw-r--r-- | packaging/libmedia-thumbnail.spec | 1 | ||||
-rwxr-xr-x | src/include/media-thumb-internal.h | 16 | ||||
-rwxr-xr-x | src/include/util/media-thumb-db.h | 6 | ||||
-rwxr-xr-x | src/include/util/media-thumb-util.h | 6 | ||||
-rwxr-xr-x | src/media-thumb-internal.c | 322 | ||||
-rwxr-xr-x | src/media-thumbnail.c | 14 | ||||
-rwxr-xr-x | src/util/media-thumb-db.c | 277 | ||||
-rwxr-xr-x | src/util/media-thumb-util.c | 34 |
18 files changed, 716 insertions, 144 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1710ff5..0cd592e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src/include INCLUDE(FindPkgConfig) pkg_check_modules(pkgs REQUIRED -glib-2.0 gthread-2.0 dlog libmedia-service mm-fileinfo drm-service aul +glib-2.0 gthread-2.0 dlog mm-fileinfo drm-service aul libexif ecore-evas evas mmutil-imgp mmutil-jpeg heynoti) diff --git a/TC/tet_scen b/TC/tet_scen index b220f82..2ff9a16 100644 --- a/TC/tet_scen +++ b/TC/tet_scen @@ -1,7 +1,6 @@ # auto generated tet_scen all "Starting Full Test Suite" - /utc/utc_thumbnail_request_from_db_func - /utc/utc_thumbnail_get_data_func + :include:/utc/tslist "Completed Full Test Suite" # EOF diff --git a/TC/utc/Makefile b/TC/utc/Makefile index c5a63ed..5742318 100644 --- a/TC/utc/Makefile +++ b/TC/utc/Makefile @@ -11,15 +11,13 @@ else endif TS1=utc_thumbnail_request_from_db_func -TS2=utc_thumbnail_get_data_func +TS2=utc_thumbnail_request_save_to_file_func -LIBS = `pkg-config --libs libmedia-thumbnail` -LIBS +=-L/usr/lib/:/usr/lib/pkgconfig +LIBS = `pkg-config --libs media-thumbnail` LIBS +=$(TET_ROOT)/lib/tet3/tcm_s.o -LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s -LIBS +=-L$(TET_ROOT)/lib/tet3/ -lapi_s +LIBS +=-L$(TET_ROOT)/lib/tet3 -ltcm_s -lapi_s -INCS = -I. `pkg-config --cflags libmedia-thumbnail` +INCS = -I. `pkg-config --cflags media-thumbnail` INCS += -I$(TET_ROOT)/inc/tet3 INCS += -I/usr/include @@ -27,7 +25,7 @@ CFLAGS = $(INCS) CC += $(CFLAGS) LDFLAGS = $(LIBS) -all : $(TS10) $(TS11) +all : $(TS1) $(TS2) $(TS1): $(TS1).c $(CC) -o $(TS1) $(TS1).c $(LDFLAGS) diff --git a/TC/utc/tslist b/TC/utc/tslist index 6ff06c4..825b84b 100644 --- a/TC/utc/tslist +++ b/TC/utc/tslist @@ -1,2 +1,2 @@ -/utc/visual/utc_thumbnail_request_from_db_func -/utc/visual/utc_thumbnail_get_data_func +/utc/utc_thumbnail_request_from_db_func +/utc/utc_thumbnail_request_save_to_file_func diff --git a/TC/utc/utc_thumbnail_request_from_db_func.c b/TC/utc/utc_thumbnail_request_from_db_func.c index a64f1b8..2d5bd15 100644 --- a/TC/utc/utc_thumbnail_request_from_db_func.c +++ b/TC/utc/utc_thumbnail_request_from_db_func.c @@ -40,7 +40,7 @@ void utc_thumbnail_request_from_db_func_01() { int ret = -1; - const char *origin_path = "/opt/media/Images and videos/Wallpapers/Home_default.png"; + const char *origin_path = "/opt/media/Images/Wallpapers/Home_default.jpg"; char thumb_path[1024] = {0,}; ret = thumbnail_request_from_db(origin_path, thumb_path, sizeof(thumb_path)); diff --git a/TC/utc/utc_thumbnail_request_save_to_file_func.c b/TC/utc/utc_thumbnail_request_save_to_file_func.c new file mode 100644 index 0000000..a9bf6e8 --- /dev/null +++ b/TC/utc/utc_thumbnail_request_save_to_file_func.c @@ -0,0 +1,90 @@ +/* + * libmedia-thumbnail + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hyunjun Ko <zzoon.ko@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** +* @file utc_thumbnail_request_save_to_file_func.c +* @brief This is a suit of unit test cases to test thumbnail_request_save_to_file API function +* @author +* @version Initial Creation Version 0.1 +* @date 2011-10-13 +*/ + +#include "utc_thumbnail_request_save_to_file_func.h" + + +/** +* @brief This tests int thumbnail_request_save_to_file() API with valid parameters +* @par ID utc_thumbnail_request_save_to_file_func_01 +* @param [in] +* @return This function returns zero on success, or negative value with error code +*/ +void utc_thumbnail_request_save_to_file_func_01() +{ + int ret = -1; + + const char *origin_path = "/opt/media/Images/Wallpapers/Home_default.jpg"; + char thumb_path[255] = { 0, }; + snprintf(thumb_path, sizeof(thumb_path), "/tmp/test_thumb.jpg"); + + media_thumb_type thumb_type = MEDIA_THUMB_LARGE; + + ret = thumbnail_request_save_to_file(origin_path, thumb_type, thumb_path); + + if (ret < MEDIA_THUMB_ERROR_NONE) { + UTC_THUMB_LOG( "unable to save thumbnail file. error code->%d", ret); + tet_result(TET_FAIL); + return; + } else { + unlink(thumb_path); + tet_result(TET_PASS); + } + + return; +} + + +/** +* @brief This tests int thumbnail_request_save_to_file() API with invalid parameters +* @par ID utc_thumbnail_request_save_to_file_func_02 +* @param [in] +* @return error code on success +*/ +void utc_thumbnail_request_save_to_file_func_02() +{ + int ret = -1; + + const char *origin_path = NULL; + char thumb_path[255] = { 0, }; + + media_thumb_type thumb_type = MEDIA_THUMB_LARGE; + + ret = thumbnail_request_save_to_file(origin_path, thumb_type, thumb_path); + if (ret < MEDIA_THUMB_ERROR_NONE) { + UTC_THUMB_LOG("abnormal condition test for null, error code->%d", ret); + tet_result(TET_PASS); + } else { + UTC_THUMB_LOG("Creating thumbnail file should be failed because the origin_path is NULL"); + tet_result(TET_FAIL); + } + + return ; +} + diff --git a/TC/utc/utc_thumbnail_request_save_to_file_func.h b/TC/utc/utc_thumbnail_request_save_to_file_func.h new file mode 100644 index 0000000..c0f4389 --- /dev/null +++ b/TC/utc/utc_thumbnail_request_save_to_file_func.h @@ -0,0 +1,52 @@ +/* + * libmedia-thumbnail + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: Hyunjun Ko <zzoon.ko@samsung.com> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +/** +* @file utc_thumbnail_request_save_to_file_func.h +* @author +* @brief This is the implementaion file for the test case of thumbnail_request_save_to_file API function +* @version Initial Creation Version 0.1 +* @date 2011-10-13 +*/ + +#ifndef __UTS_thumbnail_request_save_to_file__FUNC_H_ +#define __UTS_thumbnail_request_save_to_file__FUNC_H_ + + +#include "utc_media_thumb_common.h" + +/* Initialize TCM data structures */ +void (*tet_startup)() = NULL; +void (*tet_cleanup)() = NULL; + +void utc_thumbnail_request_save_to_file_func_01(); +void utc_thumbnail_request_save_to_file_func_02(); + +struct tet_testlist tet_testlist[] = { + {utc_thumbnail_request_save_to_file_func_01, 1}, + {utc_thumbnail_request_save_to_file_func_02, 2}, + {NULL, 0} +}; + + +#endif // __UTS_thumbnail_request_save_to_file__FUNC_H_ + diff --git a/debian/changelog b/debian/changelog index bac81d5..455bed9 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,20 @@ +libmedia-thumbnail (0.2.0-4) unstable; urgency=low + + * Change thumbnail policy - Large: 320x240, Small: 160x120 + * Remove libmedia-service dependancy + * Change of DB schema in media.db + * Git : pkgs/l/libmedia-thumbnail + * Tag : libmedia-thumbnail_0.2.0-4 + + -- Hyunjun Ko <zzoon.ko@samsung.com> Tue, 10 Feb 2012 18:30:00 +0900 + libmedia-thumbnail (0.2.0-3) unstable; urgency=low * Separates md5 codes to another shared object * Git : pkgs/l/libmedia-thumbnail * Tag : libmedia-thumbnail_0.2.0-3 - -- Hyunjun Ko <zzoon.ko@samsung.com> Tue, 3 Jan 2011 18:30:00 +0900 + -- Hyunjun Ko <zzoon.ko@samsung.com> Tue, 3 Jan 2012 18:30:00 +0900 libmedia-thumbnail (0.2.0-2) unstable; urgency=low diff --git a/debian/control b/debian/control index a5573b9..3a94b71 100755 --- a/debian/control +++ b/debian/control @@ -5,7 +5,6 @@ Maintainer: Hyunjun Ko<zzoon.ko@samsung.com>, Byungwook Jang <bw.jang@samsung.co Uploaders: Hyunjun Ko<zzoon.ko@samsung.com> Build-Depends: debhelper (>= 5), libglib2.0-dev, dlog-dev, - libmedia-service-dev, libmm-fileinfo-dev, libmm-utility-dev, drm-service-dev, @@ -38,7 +37,7 @@ Description: Media thumbnail service library for multimedia applications. Package: libmedia-thumbnail-dev Section: libdevel Architecture: any -Depends: libmedia-thumbnail (= ${Source-Version}), libmedia-service-dev, libmm-fileinfo-dev, libmm-utility-dev, libglib2.0-dev, dlog-dev, drm-service-dev, libevas-dev, libecore-dev, libexif-dev, libaul-1-dev +Depends: libmedia-thumbnail (= ${Source-Version}), libmm-fileinfo-dev, libmm-utility-dev, libglib2.0-dev, dlog-dev, drm-service-dev, libevas-dev, libecore-dev, libexif-dev, libaul-1-dev Description: Media thumbnail service library for multimedia applications. (development) Package: libmedia-thumbnail-dbg diff --git a/include/media-thumb-types.h b/include/media-thumb-types.h index c20e8ba..c73289d 100755 --- a/include/media-thumb-types.h +++ b/include/media-thumb-types.h @@ -25,8 +25,8 @@ #define _MEDIA_THUMB_TYPES_H_ typedef enum { - MEDIA_THUMB_LARGE, /* 256x256 */ - MEDIA_THUMB_SMALL, /* 96x96 */ + MEDIA_THUMB_LARGE, + MEDIA_THUMB_SMALL, } media_thumb_type; typedef enum { diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec index 4512f03..18d1785 100644 --- a/packaging/libmedia-thumbnail.spec +++ b/packaging/libmedia-thumbnail.spec @@ -7,7 +7,6 @@ License: TO_BE/FILLED_IN Source0: %{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(libmedia-service) BuildRequires: pkgconfig(mm-fileinfo) BuildRequires: pkgconfig(mmutil-imgp) BuildRequires: pkgconfig(mmutil-jpeg) diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h index 192524a..ac19f66 100755 --- a/src/include/media-thumb-internal.h +++ b/src/include/media-thumb-internal.h @@ -31,6 +31,10 @@ /* The maximum of resolution to be able to get thumbnail is 3000 x 3000, except for only jpeg */ #define THUMB_MAX_ALLOWED_MEM_FOR_THUMB 9000000 +#define THUMB_LARGE_WIDTH 320 +#define THUMB_LARGE_HEIGHT 240 +#define THUMB_SMALL_WIDTH 160 +#define THUMB_SMALL_HEIGHT 120 typedef struct { int size; @@ -54,14 +58,16 @@ enum Exif_Orientation { }; int -_media_thumb_image(const char *origin_path, - int thumb_length, - media_thumb_format format, +_media_thumb_image(const char *origin_path, + int thumb_width, + int thumb_height, + media_thumb_format format, media_thumb_info *thumb_info); int -_media_thumb_video(const char *origin_path, - int thumb_length, +_media_thumb_video(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info); diff --git a/src/include/util/media-thumb-db.h b/src/include/util/media-thumb-db.h index 1c1fd13..10b08d2 100755 --- a/src/include/util/media-thumb-db.h +++ b/src/include/util/media-thumb-db.h @@ -28,6 +28,12 @@ #define _MEDIA_THUMB_DB_H_ int +_media_thumb_db_connect(); + +int +_media_thumb_db_disconnect(); + +int _media_thumb_get_thumb_from_db(const char *origin_path, char *thumb_path, int max_length, diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h index 387fe61..7185100 100755 --- a/src/include/util/media-thumb-util.h +++ b/src/include/util/media-thumb-util.h @@ -69,6 +69,12 @@ _media_thumb_save_to_file_with_evas(unsigned char *data, int h, char *thumb_path); +int +_media_thumb_get_width(media_thumb_type thumb_type); + +int +_media_thumb_get_height(media_thumb_type thumb_type); + /** * _thumbnail_get_data: * This function generates thumbnail raw data, which is wanted by user diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 7b5b47a..513ccb4 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -44,6 +44,44 @@ #include <Ecore_Evas.h> #include <libexif/exif-data.h> +int _media_thumb_get_proper_thumb_size(media_thumb_type thumb_type, + int orig_w, int orig_h, + int *thumb_w, int *thumb_h) +{ + thumb_dbg("orig w: %d orig h: %d thumb type: %d", orig_w, orig_h, thumb_type); + + BOOL portrait = FALSE; + double ratio; + + if (orig_w < orig_h) { + portrait = TRUE; + } + + if (portrait) { + if (orig_h < _media_thumb_get_width(thumb_type)) { + *thumb_h = orig_h; + } else { + *thumb_h = _media_thumb_get_width(thumb_type); + } + + ratio = (double)orig_w / (double)orig_h; + *thumb_w = *thumb_h * ratio; + } else { + if (orig_w < _media_thumb_get_width(thumb_type)) { + *thumb_w = orig_w; + } else { + *thumb_w = _media_thumb_get_width(thumb_type); + } + + ratio = (double)orig_h / (double)orig_w; + *thumb_h = *thumb_w * ratio; + } + + thumb_dbg("proper thumb w: %d h: %d", *thumb_w, *thumb_h); + + return 0; +} + int _media_thumb_get_exif_info(ExifData *ed, char *buf, int max_size, int *value, int ifdtype, long tagtype) { @@ -161,13 +199,6 @@ _media_thumb_get_thumb_from_exif(ExifData *ed, thumb_height = value; } -/* - if (thumb_width < required_width && - thumb_height < required_height) { - thumb_dbg("Size of thumb from exif is small"); - return -1; - } -*/ if (ed->data && ed->size) { thumb_dbg("Size: %d, thumb: 0x%x\n", ed->size, ed->data); @@ -256,7 +287,71 @@ _media_thumb_get_thumb_from_exif(ExifData *ed, } thumb_dbg("size:%d, w:%d, h:%d\n", decoded.size, decoded.width, decoded.height); -#if 1 + + thumb_width = decoded.width; + thumb_height = decoded.height; + + media_thumb_type thumb_type; + int need_resize = 0; + unsigned int buf_size = decoded.size; + + if (required_width == _media_thumb_get_width(MEDIA_THUMB_LARGE)) { + thumb_type = MEDIA_THUMB_LARGE; + } else { + thumb_type = MEDIA_THUMB_SMALL; + } + + if (thumb_type == MEDIA_THUMB_LARGE) { + if (thumb_width < _media_thumb_get_width(MEDIA_THUMB_LARGE)) { + thumb_dbg("Thumb data in exif is too small for MEDIA_THUMB_LARGE"); + SAFE_FREE(decoded.data); + return -1; + } + } else { + if (thumb_width > _media_thumb_get_width(MEDIA_THUMB_SMALL)) { + need_resize = 1; + } + } + + if (need_resize == 1) { + int resized_w = _media_thumb_get_width(MEDIA_THUMB_LARGE); + int resized_h = _media_thumb_get_height(MEDIA_THUMB_LARGE); + + err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, resized_w, resized_h, &buf_size); + if (err < 0) { + thumb_dbg("mm_util_get_image_size failed : %d", err); + + SAFE_FREE(decoded.data); + return err; + } + + thumb_dbg("size(RGB888) : %d", buf_size); + + unsigned char *dst = (unsigned char *)malloc(buf_size); + if (dst == NULL) { + thumb_err("Failed to allocate memory!"); + SAFE_FREE(decoded.data); + return -1; + } + + if (mm_util_resize_image(decoded.data, thumb_width, + thumb_height, MM_UTIL_IMG_FMT_RGB888, + dst, (unsigned int *)&resized_w, + (unsigned int *)&resized_h) < 0) { + thumb_err("Failed to resize the thumbnails"); + + SAFE_FREE(decoded.data); + SAFE_FREE(dst); + + return -1; + } + + SAFE_FREE(decoded.data); + decoded.data = dst; + decoded.width = thumb_width = resized_w; + decoded.height = thumb_height = resized_h; + } + if (orientation == ROT_90 || orientation == ROT_180 || orientation == ROT_270) { /* Start to decode to rotate */ unsigned char *rotated = NULL; @@ -278,11 +373,10 @@ _media_thumb_get_thumb_from_exif(ExifData *ed, err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, r_w, r_h, &r_size); if (err < 0) { thumb_dbg("mm_util_get_image_size failed : %d", err); - SAFE_FREE(decoded.data); return err; } - + thumb_dbg("Size of Rotated : %d", r_size); #if 1 @@ -369,30 +463,16 @@ _media_thumb_get_thumb_from_exif(ExifData *ed, thumb_info->width = r_w; thumb_info->height = r_h; } else if (orientation == NORMAL) { -#endif - unsigned int buf_size = 0; - - err = mm_util_get_image_size(MM_UTIL_IMG_FMT_RGB888, decoded.width, decoded.height, &buf_size); - if (err < 0) { - thumb_dbg("mm_util_get_image_size failed : %d", err); - - SAFE_FREE(decoded.data); - return err; - } - - thumb_dbg("size(RGB888) : %d", buf_size); - thumb_info->data = decoded.data; thumb_info->size = buf_size; - thumb_info->width = decoded.width; - thumb_info->height = decoded.height; -#if 1 + thumb_info->width = thumb_width; + thumb_info->height = thumb_height; } else { thumb_warn("Unknown orientation"); SAFE_FREE(decoded.data); return -1; } -#endif + return 0; } @@ -481,34 +561,18 @@ int _media_thumb_get_wh_with_evas(const char *origin_path, int *width, int *heig return 0; } -int _media_thumb_decode_with_evas(const char *origin_path, int thumb_length, +int _media_thumb_decode_with_evas(const char *origin_path, + int thumb_width, int thumb_height, media_thumb_info *thumb_info, int need_scale) { ecore_evas_init(); - Ecore_Evas *ee = ecore_evas_buffer_new( - thumb_length, thumb_length); - if (!ee) { - thumb_err("Failed to create a ecore evas\n"); - ecore_evas_shutdown(); - return -1; - } - - Evas *evas = ecore_evas_get(ee); - if (!evas) { - thumb_err("Failed to ecore_evas_get\n"); - ecore_evas_free(ee); - ecore_evas_shutdown(); - return -1; - } - Ecore_Evas *resize_img_ee; resize_img_ee = - ecore_evas_buffer_new(thumb_length, thumb_length); + ecore_evas_buffer_new(thumb_width, thumb_height); if (!resize_img_ee) { thumb_err("Failed to create a new ecore evas buffer\n"); - ecore_evas_free(ee); ecore_evas_shutdown(); return -1; } @@ -516,7 +580,6 @@ int _media_thumb_decode_with_evas(const char *origin_path, int thumb_length, Evas *resize_img_e = ecore_evas_get(resize_img_ee); if (!resize_img_e) { thumb_err("Failed to ecore_evas_get\n"); - ecore_evas_free(ee); ecore_evas_free(resize_img_ee); ecore_evas_shutdown(); return -1; @@ -526,13 +589,11 @@ int _media_thumb_decode_with_evas(const char *origin_path, int thumb_length, if (!source_img) { thumb_dbg ("evas_object_image_add failed\n"); - ecore_evas_free(ee); ecore_evas_free(resize_img_ee); ecore_evas_shutdown(); return -1; } - evas_object_image_load_size_set(source_img, thumb_length, thumb_length); evas_object_image_load_orientation_set(source_img, 1); evas_object_image_file_set(source_img, origin_path, NULL); @@ -550,42 +611,83 @@ int _media_thumb_decode_with_evas(const char *origin_path, int thumb_length, evas_object_image_load_scale_down_set(source_img, 10); } + int err = -1; + media_thumb_type thumb_type; + + if (thumb_width == _media_thumb_get_width(MEDIA_THUMB_LARGE)) { + thumb_type = MEDIA_THUMB_LARGE; + } else { + thumb_type = MEDIA_THUMB_SMALL; + } + + err = _media_thumb_get_proper_thumb_size(thumb_type, + thumb_info->origin_width, thumb_info->origin_height, + &thumb_width, &thumb_height); + if (err < 0) { + thumb_err("_media_thumb_get_proper_thumb_size failed: %d", err); + ecore_evas_free(resize_img_ee); + ecore_evas_shutdown(); + return err; + } + + ecore_evas_resize(resize_img_ee, thumb_width, thumb_height); + + evas_object_image_load_size_set(source_img, thumb_width, thumb_height); evas_object_image_fill_set(source_img, 0, 0, - thumb_length, - thumb_length); + thumb_width, + thumb_height); evas_object_image_filled_set(source_img, 1); evas_object_resize(source_img, - thumb_length, - thumb_length); + thumb_width, + thumb_height); evas_object_show(source_img); + /* Create target buffer and copy origin resized img to it */ + Ecore_Evas *target_ee = ecore_evas_buffer_new( + thumb_width, thumb_height); + if (!target_ee) { + thumb_err("Failed to create a ecore evas\n"); + ecore_evas_free(resize_img_ee); + ecore_evas_shutdown(); + return -1; + } + + Evas *target_evas = ecore_evas_get(target_ee); + if (!target_evas) { + thumb_err("Failed to ecore_evas_get\n"); + ecore_evas_free(resize_img_ee); + ecore_evas_free(target_ee); + ecore_evas_shutdown(); + return -1; + } + Evas_Object *ret_image = - evas_object_image_add(evas); + evas_object_image_add(target_evas); evas_object_image_size_set(ret_image, - thumb_length, - thumb_length); + thumb_width, + thumb_height); evas_object_image_fill_set(ret_image, 0, 0, - thumb_length, - thumb_length); + thumb_width, + thumb_height); evas_object_image_filled_set(ret_image, EINA_TRUE); evas_object_image_data_set(ret_image, (int *)ecore_evas_buffer_pixels_get(resize_img_ee)); - evas_object_image_data_update_add(ret_image, 0, 0, thumb_length, - thumb_length); + 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_length, - thumb_length, &buf_size) < 0) { + if (mm_util_get_image_size(MM_UTIL_IMG_FMT_BGRA8888, thumb_width, + thumb_height, &buf_size) < 0) { thumb_err("Failed to get buffer size"); - ecore_evas_free(ee); ecore_evas_free(resize_img_ee); + ecore_evas_free(target_ee); ecore_evas_shutdown(); return MEDIA_THUMB_ERROR_MM_UTIL; @@ -594,12 +696,12 @@ int _media_thumb_decode_with_evas(const char *origin_path, int thumb_length, thumb_dbg("mm_util_get_image_size : %d", buf_size); thumb_info->size = buf_size; - thumb_info->width = thumb_length; - thumb_info->height = thumb_length; + thumb_info->width = thumb_width; + thumb_info->height = thumb_height; thumb_info->data = malloc(buf_size); memcpy(thumb_info->data, evas_object_image_data_get(ret_image, 1), buf_size); - ecore_evas_free(ee); + ecore_evas_free(target_ee); ecore_evas_free(resize_img_ee); ecore_evas_shutdown(); @@ -714,19 +816,34 @@ int _media_thumb_convert_format(media_thumb_info *thumb_info, return 0; } -int _media_thumb_agif(const char *origin_path, +int _media_thumb_agif(const char *origin_path, ImgImageInfo *image_info, - int thumb_length, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { int err = -1; - int thumb_width = thumb_length; - int thumb_height = thumb_length; unsigned int *thumb = NULL; + media_thumb_type thumb_type; thumb = ImgGetFirstFrameAGIFAtSize(origin_path, image_info); - + + if (thumb_width == _media_thumb_get_width(MEDIA_THUMB_LARGE)) { + thumb_type = MEDIA_THUMB_LARGE; + } else { + thumb_type = MEDIA_THUMB_SMALL; + } + + err = _media_thumb_get_proper_thumb_size(thumb_type, + thumb_info->origin_width, thumb_info->origin_height, + &thumb_width, &thumb_height); + if (err < 0) { + thumb_err("_media_thumb_get_proper_thumb_size failed: %d", err); + SAFE_FREE(thumb); + return err; + } + err = _media_thumb_resize_data((unsigned char *)thumb, image_info->width, image_info->height, @@ -753,13 +870,14 @@ int _media_thumb_agif(const char *origin_path, return 0; } -int _media_thumb_png(const char *origin_path, - int thumb_length, +int _media_thumb_png(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_length, thumb_info, 0); + err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0); if (err < 0) { thumb_err("decode_with_evas failed : %d", err); @@ -776,13 +894,14 @@ int _media_thumb_png(const char *origin_path, return 0; } -int _media_thumb_bmp(const char *origin_path, - int thumb_length, +int _media_thumb_bmp(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_length, thumb_info, 0); + err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0); if (err < 0) { thumb_err("decode_with_evas failed : %d", err); @@ -799,13 +918,14 @@ int _media_thumb_bmp(const char *origin_path, return 0; } -int _media_thumb_wbmp(const char *origin_path, - int thumb_length, +int _media_thumb_wbmp(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_length, thumb_info, 0); + err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0); if (err < 0) { thumb_err("decode_with_evas failed : %d", err); @@ -823,12 +943,13 @@ int _media_thumb_wbmp(const char *origin_path, } int _media_thumb_gif(const char *origin_path, - int thumb_length, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { int err = -1; - err = _media_thumb_decode_with_evas(origin_path, thumb_length, thumb_info, 0); + err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0); if (err < 0) { thumb_err("decode_with_evas failed : %d", err); @@ -845,8 +966,9 @@ int _media_thumb_gif(const char *origin_path, return 0; } -int _media_thumb_jpeg(const char *origin_path, - int thumb_length, +int _media_thumb_jpeg(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { @@ -869,7 +991,7 @@ int _media_thumb_jpeg(const char *origin_path, thumb_dbg("Orientation: %d", orientation); /* Second, Get thumb from exif */ - err = _media_thumb_get_thumb_from_exif(ed, origin_path, orientation, thumb_length, thumb_length, thumb_info); + err = _media_thumb_get_thumb_from_exif(ed, origin_path, orientation, thumb_width, thumb_height, thumb_info); if (err < 0) { thumb_dbg("_media_thumb_get_thumb_from_exif failed"); @@ -898,7 +1020,7 @@ int _media_thumb_jpeg(const char *origin_path, if (!thumb_done) { - err = _media_thumb_decode_with_evas(origin_path, thumb_length, thumb_info, 0); + err = _media_thumb_decode_with_evas(origin_path, thumb_width, thumb_height, thumb_info, 0); if (err < 0) { thumb_err("decode_with_evas failed : %d", err); @@ -917,8 +1039,9 @@ int _media_thumb_jpeg(const char *origin_path, } int -_media_thumb_image(const char *origin_path, - int thumb_length, +_media_thumb_image(const char *origin_path, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { @@ -943,15 +1066,15 @@ _media_thumb_image(const char *origin_path, } if (image_type == IMG_CODEC_AGIF) { - err = _media_thumb_agif(origin_path, &image_info, thumb_length, format, thumb_info); + err = _media_thumb_agif(origin_path, &image_info, thumb_width, thumb_height, format, thumb_info); } else if (image_type == IMG_CODEC_JPEG) { - err = _media_thumb_jpeg(origin_path, thumb_length, format, thumb_info); + err = _media_thumb_jpeg(origin_path, thumb_width, thumb_height, format, thumb_info); } else if (image_type == IMG_CODEC_PNG) { - err = _media_thumb_png(origin_path, thumb_length, format, thumb_info); + err = _media_thumb_png(origin_path, thumb_width, thumb_height, format, thumb_info); } else if (image_type == IMG_CODEC_GIF) { - err = _media_thumb_gif(origin_path, thumb_length, format, thumb_info); + err = _media_thumb_gif(origin_path, thumb_width, thumb_height, format, thumb_info); } else if (image_type == IMG_CODEC_BMP) { - err = _media_thumb_bmp(origin_path, thumb_length, format, thumb_info); + err = _media_thumb_bmp(origin_path, thumb_width, thumb_height, format, thumb_info); } else { char file_ext[10]; err = _media_thumb_get_file_ext(origin_path, file_ext, sizeof(file_ext)); @@ -977,7 +1100,7 @@ _media_thumb_image(const char *origin_path, thumb_info->origin_width = wbmp_width; thumb_info->origin_height = wbmp_height; - err = _media_thumb_wbmp(origin_path, thumb_length, format, thumb_info); + err = _media_thumb_wbmp(origin_path, thumb_width, thumb_height, format, thumb_info); return err; } @@ -992,7 +1115,8 @@ _media_thumb_image(const char *origin_path, int _media_thumb_video(const char *origin_path, - int thumb_length, + int thumb_width, + int thumb_height, media_thumb_format format, media_thumb_info *thumb_info) { @@ -1056,14 +1180,14 @@ _media_thumb_video(const char *origin_path, return MEDIA_THUMB_ERROR_MM_UTIL; } - if (width > thumb_length || height > thumb_length) { + if (width > thumb_width || height > thumb_height) { err = _media_thumb_resize_data(frame, width, - height, + height, MM_UTIL_IMG_FMT_RGB888, thumb_info, - thumb_length, - thumb_length); + thumb_width, + thumb_height); if (err < 0) { thumb_err("_media_thumb_resize_data failed - %d", err); diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c index 585be8c..7d7165c 100755 --- a/src/media-thumbnail.c +++ b/src/media-thumbnail.c @@ -27,7 +27,6 @@ #include "media-thumb-db.h" #include <glib.h> -#include <media-svc.h> int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length) { @@ -61,11 +60,16 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max thumb_err("Path : %s", origin_path); - err = minfo_init(); + //err = minfo_init(); + err = _media_thumb_db_connect(); + if (err < 0) { + thumb_err("_media_thumb_mb_svc_connect failed: %d", err); + return MEDIA_THUMB_ERROR_DB; + } err = _media_thumb_get_thumb_from_db(origin_path, thumb_path, max_length, &need_update_db); if (err == 0) { - minfo_finalize(); + _media_thumb_db_disconnect(); return MEDIA_THUMB_ERROR_NONE; } @@ -73,7 +77,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max err = _media_thumb_request(THUMB_REQUEST_DB, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info); if (err < 0) { thumb_err("_media_thumb_request failed : %d", err); - minfo_finalize(); + _media_thumb_db_disconnect(); return err; } @@ -85,7 +89,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max } } - minfo_finalize(); + _media_thumb_db_disconnect(); return MEDIA_THUMB_ERROR_NONE; } diff --git a/src/util/media-thumb-db.c b/src/util/media-thumb-db.c index f0e41ad..8893f0b 100755 --- a/src/util/media-thumb-db.c +++ b/src/util/media-thumb-db.c @@ -20,9 +20,253 @@ */ #include "media-thumb-db.h" -#include <media-svc.h> +//#include <media-svc.h> +//#include <visual-svc.h> #include <glib.h> #include <string.h> +#include <unistd.h> +#include <util-func.h> + +//__thread MediaSvcHandle *mb_svc_handle = NULL; +__thread sqlite3 *db_handle; +const char *MEDIA_DATABASE_NAME = "/opt/dbspace/.media.db"; +const char *SELECT_MEDIA_BY_PATH = "SELECT thumbnail_path FROM visual_media WHERE path='%q';"; +const char *UPDATE_THUMB_BY_PATH = "UPDATE visual_media SET thumbnail_path = '%q' WHERE path='%q';"; +const char *UPDATE_WH_BY_PATH = "UPDATE image_meta SET width=%d,height=%d WHERE visual_uuid=(SELECT visual_uuid FROM visual_media WHERE path='%q');"; + +static int _media_thumb_busy_handler(void *pData, int count) +{ + usleep(50000); + thumb_dbg("_media_thumb_busy_handler called : %d\n", count); + + return 100 - count; +} + +int +_media_thumb_sqlite_connect(sqlite3 **handle) +{ + int err = -1; + err = db_util_open(MEDIA_DATABASE_NAME, handle, + DB_UTIL_REGISTER_HOOK_METHOD); + + if (SQLITE_OK != err) { + *handle = NULL; + return -1; + } + + /*Register busy handler*/ + err = sqlite3_busy_handler(*handle, _media_thumb_busy_handler, NULL); + if (SQLITE_OK != err) { + if (*handle) thumb_err("[sqlite] %s\n", sqlite3_errmsg(*handle)); + + db_util_close(*handle); + *handle = NULL; + + return -1; + } + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_sqlite_disconnect(sqlite3 *handle) +{ + int err = -1; + if (handle != NULL) { + err = db_util_close(handle); + + if (SQLITE_OK != err) { + handle = NULL; + return -1; + } + } + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_get_thumb_path_from_db(sqlite3 *handle, + const char *origin_path, + char *thumb_path, + int max_length) +{ + thumb_dbg("Origin path : %s", origin_path); + + if (handle == NULL) { + thumb_err("DB handle is NULL"); + return -1; + } + + int err = -1; + char *path_string = NULL; + char *query_string = NULL; + sqlite3_stmt *stmt = NULL; + + path_string = sqlite3_mprintf("%s", origin_path); + query_string = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path_string); + + thumb_dbg("Query: %s", query_string); + + err = sqlite3_prepare_v2(handle, query_string, strlen(query_string), &stmt, NULL); + + sqlite3_free(query_string); + sqlite3_free(path_string); + + if (SQLITE_OK != err) { + thumb_err("prepare error [%s]\n", sqlite3_errmsg(handle)); + return -1; + } + + err = sqlite3_step(stmt); + if (err != SQLITE_ROW) { + thumb_err("end of row [%s]\n", sqlite3_errmsg(handle)); + sqlite3_finalize(stmt); + return -1; + } + + strncpy(thumb_path, (const char *)sqlite3_column_text(stmt, 0), max_length); + sqlite3_finalize(stmt); + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_update_thumb_path_to_db(sqlite3 *handle, + const char *origin_path, + char *thumb_path) +{ + thumb_dbg(""); + int err = -1; + char *path_string = NULL; + char *thumbpath_string = NULL; + char *query_string = NULL; + char *err_msg = NULL; + + if (handle == NULL) { + thumb_err("DB handle is NULL"); + return -1; + } + + path_string = sqlite3_mprintf("%s", origin_path); + thumbpath_string = sqlite3_mprintf("%s", thumb_path); + query_string = sqlite3_mprintf(UPDATE_THUMB_BY_PATH, thumbpath_string, path_string); + + err = sqlite3_exec(handle, query_string, NULL, NULL, &err_msg); + + thumb_dbg("Query : %s", query_string); + + sqlite3_free(query_string); + sqlite3_free(thumbpath_string); + sqlite3_free(path_string); + + if (SQLITE_OK != err) { + if (err_msg) { + thumb_err("Failed to query[ %s ]", err_msg); + sqlite3_free(err_msg); + err_msg = NULL; + } + + return -1; + } + + if (err_msg) + sqlite3_free(err_msg); + + thumb_dbg("Query success"); + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_update_wh_to_db(sqlite3 *handle, + const char *origin_path, + int width, + int height) +{ + thumb_dbg(""); + int err = -1; + char *path_string = NULL; + char *query_string = NULL; + char *err_msg = NULL; + + if (handle == NULL) { + thumb_err("DB handle is NULL"); + return -1; + } + + path_string = sqlite3_mprintf("%s", origin_path); + query_string = sqlite3_mprintf(UPDATE_WH_BY_PATH, width, height, path_string); + + err = sqlite3_exec(handle, query_string, NULL, NULL, &err_msg); + + thumb_dbg("Query : %s", query_string); + + sqlite3_free(query_string); + sqlite3_free(path_string); + + if (SQLITE_OK != err) { + if (err_msg) { + thumb_err("Failed to query[ %s ]", err_msg); + sqlite3_free(err_msg); + err_msg = NULL; + } + + return -1; + } + + if (err_msg) + sqlite3_free(err_msg); + + thumb_dbg("Query success"); + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_db_connect() +{ + int err = -1; +/* + err = media_svc_connect(&mb_svc_handle); + if (err < 0) { + thumb_err("media_svc_connect failed: %d", err); + mb_svc_handle = NULL; + return err; + } +*/ + err = _media_thumb_sqlite_connect(&db_handle); + if (err < 0) { + thumb_err("_media_thumb_sqlite_connect failed: %d", err); + db_handle = NULL; + return err; + } + + return MEDIA_THUMB_ERROR_NONE; +} + +int +_media_thumb_db_disconnect() +{ + int err = -1; +/* + err = media_svc_disconnect(mb_svc_handle); + + if (err < 0) { + thumb_err("media_svc_disconnect failed: %d", err); + } + + mb_svc_handle = NULL; +*/ + err = _media_thumb_sqlite_disconnect(db_handle); + if (err < 0) { + thumb_err("_media_thumb_sqlite_disconnect failed: %d", err); + db_handle = NULL; + return err; + } + + db_handle = NULL; + return err; +} int _media_thumb_get_thumb_from_db(const char *origin_path, @@ -33,7 +277,8 @@ _media_thumb_get_thumb_from_db(const char *origin_path, thumb_dbg(""); int err = -1; - err = minfo_get_thumb_path(origin_path, thumb_path, max_length); + //err = minfo_get_thumb_path(mb_svc_handle, origin_path, thumb_path, max_length); + err = _media_thumb_get_thumb_path_from_db(db_handle, origin_path, thumb_path, max_length); if (err < 0) { thumb_warn("Original path doesn't exist in DB"); return -1; @@ -56,7 +301,7 @@ _media_thumb_get_thumb_from_db(const char *origin_path, thumb_dbg("This thumb path already exist"); } - return 0; + return MEDIA_THUMB_ERROR_NONE; } int @@ -67,15 +312,17 @@ _media_thumb_update_db(const char *origin_path, { thumb_dbg(""); int err = -1; + +#if 0 Mitem *item = NULL; - err = minfo_get_item(origin_path, &item); + err = minfo_get_item(mb_svc_handle, origin_path, &item); if (err < 0) { thumb_err("minfo_get_item (%s) failed: %d", origin_path, err); return MEDIA_THUMB_ERROR_DB; } - err = minfo_update_media_thumb(item->uuid, thumb_path); + err = minfo_update_media_thumb(mb_svc_handle, item->uuid, thumb_path); if (err < 0) { thumb_err("minfo_update_media_thumb (ID:%s, %s) failed: %d", item->uuid, thumb_path, err); @@ -84,8 +331,9 @@ _media_thumb_update_db(const char *origin_path, } if (item->type == MINFO_ITEM_IMAGE) { - err = minfo_update_image_meta_info_int(item->uuid, MINFO_IMAGE_META_WIDTH, width, - MINFO_IMAGE_META_HEIGHT, height, -1); + err = minfo_update_image_meta_info_int(mb_svc_handle, item->uuid, + MINFO_IMAGE_META_WIDTH, width, + MINFO_IMAGE_META_HEIGHT, height, -1); if (err < 0) { thumb_err("minfo_update_image_meta_info_int failed: %d", err); @@ -95,9 +343,22 @@ _media_thumb_update_db(const char *origin_path, } err = minfo_destroy_mtype_item(item); +#endif + + err = _media_thumb_update_thumb_path_to_db(db_handle, origin_path, thumb_path); + if (err < 0) { + thumb_err("_media_thumb_update_thumb_path_to_db (%s) failed: %d", origin_path, err); + return MEDIA_THUMB_ERROR_DB; + } + + err = _media_thumb_update_wh_to_db(db_handle, origin_path, width, height); + if (err < 0) { + thumb_err("_media_thumb_update_wh_to_db (%s) failed: %d", origin_path, err); + return MEDIA_THUMB_ERROR_DB; + } thumb_dbg("_media_thumb_update_db success"); - return 0; + return MEDIA_THUMB_ERROR_NONE; } diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c index 7d34a7a..f224c17 100755 --- a/src/util/media-thumb-util.c +++ b/src/util/media-thumb-util.c @@ -30,12 +30,23 @@ #include <Evas.h> #include <Ecore_Evas.h> -int _media_thumb_get_length(media_thumb_type thumb_type) +int _media_thumb_get_width(media_thumb_type thumb_type) { if (thumb_type == MEDIA_THUMB_LARGE) { - return 256; + return THUMB_LARGE_WIDTH; } else if (thumb_type == MEDIA_THUMB_SMALL) { - return 96; + return THUMB_SMALL_WIDTH; + } else { + return -1; + } +} + +int _media_thumb_get_height(media_thumb_type thumb_type) +{ + if (thumb_type == MEDIA_THUMB_LARGE) { + return THUMB_LARGE_HEIGHT; + } else if (thumb_type == MEDIA_THUMB_SMALL) { + return THUMB_SMALL_HEIGHT; } else { return -1; } @@ -256,7 +267,8 @@ int _thumbnail_get_data(const char *origin_path, int *origin_height) { int err = -1; - int thumb_length = -1; + int thumb_width = -1; + int thumb_height = -1; if (origin_path == NULL || size == NULL || width == NULL || height == NULL) { @@ -275,8 +287,14 @@ int _thumbnail_get_data(const char *origin_path, return MEDIA_THUMB_ERROR_INVALID_PARAMETER; } - thumb_length = _media_thumb_get_length(thumb_type); - if (thumb_length < 0) { + thumb_width = _media_thumb_get_width(thumb_type); + if (thumb_width < 0) { + thumb_err("media_thumb_type is invalid"); + return MEDIA_THUMB_ERROR_INVALID_PARAMETER; + } + + thumb_height = _media_thumb_get_height(thumb_type); + if (thumb_height < 0) { thumb_err("media_thumb_type is invalid"); return MEDIA_THUMB_ERROR_INVALID_PARAMETER; } @@ -288,14 +306,14 @@ int _thumbnail_get_data(const char *origin_path, file_type = _media_thumb_get_file_type(origin_path); if (file_type == THUMB_IMAGE_TYPE) { - err = _media_thumb_image(origin_path, thumb_length, format, &thumb_info); + err = _media_thumb_image(origin_path, thumb_width, thumb_height, format, &thumb_info); if (err < 0) { thumb_err("_media_thumb_image failed"); return err; } } else if (file_type == THUMB_VIDEO_TYPE) { - err = _media_thumb_video(origin_path, thumb_length, format, &thumb_info); + err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info); if (err < 0) { thumb_err("_media_thumb_image failed"); return err; |