summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/libmedia-thumbnail.spec2
-rwxr-xr-xsrc/include/util/media-thumb-util.h10
-rwxr-xr-xsrc/media-thumb-internal.c20
-rwxr-xr-xsrc/media-thumbnail.c16
-rwxr-xr-xsrc/util/media-thumb-util.c13
5 files changed, 18 insertions, 43 deletions
diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec
index 7a104bf..24abd5d 100644
--- a/packaging/libmedia-thumbnail.spec
+++ b/packaging/libmedia-thumbnail.spec
@@ -1,6 +1,6 @@
Name: libmedia-thumbnail
Summary: Media thumbnail service library for multimedia applications
-Version: 0.2.4
+Version: 0.2.5
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0 and PD
diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h
index 046110c..1ee8384 100755
--- a/src/include/util/media-thumb-util.h
+++ b/src/include/util/media-thumb-util.h
@@ -39,21 +39,11 @@ typedef enum {
#define THUMB_IMAGE_TYPE 0 /* Image */
#define THUMB_VIDEO_TYPE 1 /* Video */
-#define THUMB_PATH_PHONE MEDIA_ROOT_PATH_INTERNAL /**< File path prefix of files stored in phone */
-#define THUMB_PATH_MMC MEDIA_ROOT_PATH_SDCARD /**< File path prefix of files stored in mmc card */
-
#define THUMB_PHONE_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone")
#define THUMB_MMC_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc")
#define THUMB_DEFAULT_PATH tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/thumb_default.png")
-typedef enum {
- THUMB_PHONE, /**< Stored only in phone */
- THUMB_MMC /**< Stored only in MMC */
-} media_thumb_store_type;
-
-int _media_thumb_get_store_type_by_path(const char *full_path);
-
int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len);
int _media_thumb_get_file_type(const char *file_full_path);
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 28914f0..2d0ac3d 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -1611,7 +1611,8 @@ int _media_thumb_get_hash_name(const char *file_full_path,
char file_ext[255] = { 0 };
char *get_path = NULL;
int ret_len = 0;
- media_thumb_store_type store_type = -1;
+ ms_user_storage_type_t store_type = -1;
+ int ret = 0;
if (file_full_path == NULL || thumb_hash_path == NULL || max_thumb_path <= 0) {
thumb_err("file_full_path==NULL || thumb_hash_path == NULL || max_thumb_path <= 0");
@@ -1620,14 +1621,11 @@ int _media_thumb_get_hash_name(const char *file_full_path,
_media_thumb_get_file_ext(file_full_path, file_ext, sizeof(file_ext));
- store_type = _media_thumb_get_store_type_by_path(file_full_path);
- /*if (store_type == THUMB_PHONE) {
- thumb_dir = _media_thumb_phone_get_path(uid);
- } else if (store_type == THUMB_MMC) {
- thumb_dir = _media_thumb_mmc_get_path(uid);
- } else {
- thumb_dir = _media_thumb_phone_get_path(uid);
- }*/
+ ret = ms_user_get_storage_type(uid, file_full_path, &store_type);
+ if((ret != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
+ thumb_err("origin path(%s) is invalid. err : [%d] store_type [%d]", file_full_path, ret, store_type);
+ return MS_MEDIA_ERR_INVALID_PARAMETER;
+ }
hash_name = _media_thumb_generate_hash_name(file_full_path);
if (hash_name == NULL) {
@@ -1635,11 +1633,11 @@ int _media_thumb_get_hash_name(const char *file_full_path,
return MS_MEDIA_ERR_INTERNAL;
}
- if (store_type == THUMB_PHONE) {
+ if (store_type == MS_USER_STORAGE_INTERNAL) {
get_path = _media_thumb_phone_get_path(uid);
if (get_path != NULL)
ret_len = snprintf(thumb_hash_path, max_thumb_path - 1, "%s/.%s-%s.jpg", get_path, file_ext, hash_name);
- } else if (store_type == THUMB_MMC) {
+ } else if (store_type == MS_USER_STORAGE_EXTERNAL) {
get_path = _media_thumb_mmc_get_path(uid);
if (get_path != NULL)
ret_len = snprintf(thumb_hash_path, max_thumb_path - 1, "%s/.%s-%s.jpg", get_path, file_ext, hash_name);
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index dab1de7..4792ac1 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -52,11 +52,11 @@ int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_pat
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- int store_type = -1;
- store_type = _media_thumb_get_store_type_by_path(origin_path);
+ ms_user_storage_type_t store_type = -1;
+ err = ms_user_get_storage_type(uid, origin_path, &store_type);
- if ((store_type != THUMB_PHONE) && (store_type != THUMB_MMC)) {
- thumb_err("origin path(%s) is invalid", origin_path);
+ if((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
+ thumb_err("origin path(%s) is invalid. err : [%d] store_type [%d]", origin_path, err, store_type);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
@@ -107,11 +107,11 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- int store_type = -1;
- store_type = _media_thumb_get_store_type_by_path(origin_path);
+ ms_user_storage_type_t store_type = -1;
+ err = ms_user_get_storage_type(uid, origin_path, &store_type);
- if ((store_type != THUMB_PHONE) && (store_type != THUMB_MMC)) {
- thumb_err("origin path(%s) is invalid", origin_path);
+ if((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
+ thumb_err("origin path(%s) is invalid. err : [%d] store_type [%d]", origin_path, err, store_type);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index a0e5282..b026ce9 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -91,19 +91,6 @@ _media_thumb_get_file_type(const char *file_full_path)
return THUMB_NONE_TYPE;
}
-int _media_thumb_get_store_type_by_path(const char *full_path)
-{
- if (full_path != NULL && THUMB_PATH_PHONE != NULL && THUMB_PATH_MMC != NULL) {
- if (strncmp(full_path, THUMB_PATH_PHONE, strlen(THUMB_PATH_PHONE)) == 0) {
- return THUMB_PHONE;
- } else if (strncmp(full_path, THUMB_PATH_MMC, strlen(THUMB_PATH_MMC)) == 0) {
- return THUMB_MMC;
- }
- }
-
- return -1;
-}
-
int _media_thumb_remove_file(const char *path)
{
int result = -1;