diff options
author | Haejeong Kim <backto.kim@samsung.com> | 2017-05-18 20:18:39 +0900 |
---|---|---|
committer | Haejeong Kim <backto.kim@samsung.com> | 2017-05-18 20:18:39 +0900 |
commit | 73f45fa1ed096b33c0525d314f7167914b29ef03 (patch) | |
tree | 61129d9d41865bbf9c56f5ed4a01ff31fb55f3ec | |
parent | a7da43c015a4a553c0e1ddd5c569ee09b96bcb01 (diff) | |
download | libmedia-thumbnail-73f45fa1ed096b33c0525d314f7167914b29ef03.tar.gz libmedia-thumbnail-73f45fa1ed096b33c0525d314f7167914b29ef03.tar.bz2 libmedia-thumbnail-73f45fa1ed096b33c0525d314f7167914b29ef03.zip |
Use Common API in libmedia-util to get thumb store pathsubmit/tizen/20170519.020052
Change-Id: I4791acb2d3856c6bd9f601bbe237d22f90de833f
-rwxr-xr-x | src/media-thumb-internal.c | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c index 99e0cc1..ecd7d8e 100755 --- a/src/media-thumb-internal.c +++ b/src/media-thumb-internal.c @@ -1567,42 +1567,6 @@ int _media_thumb_video(const char *origin_path, return err; } -static char* _media_thumb_mmc_get_path(uid_t uid) -{ - int ret = 0; - char *result_path = NULL; - - ret = tzplatform_set_user(uid); - if (ret != 0) { - thumb_err("Invalid UID[%d]", uid); - return NULL; - } else { - const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/mmc"); - result_path = strndup(result, strlen(result)); - tzplatform_reset_user(); - } - - return result_path; -} - -static char* _media_thumb_phone_get_path(uid_t uid) -{ - int ret = 0; - char *result_path = NULL; - - ret = tzplatform_set_user(uid); - if (ret != 0) { - thumb_err("Invalid UID[%d]", uid); - return NULL; - } else { - const char *result = tzplatform_mkpath(TZ_USER_SHARE, "media/.thumb/phone"); - result_path = strndup(result, strlen(result)); - tzplatform_reset_user(); - } - - return result_path; -} - int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid) { @@ -1612,7 +1576,7 @@ int _media_thumb_get_hash_name(const char *file_full_path, char *get_path = NULL; int ret_len = 0; ms_user_storage_type_t store_type = -1; - int ret = 0; + int ret = MS_MEDIA_ERR_NONE; 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"); @@ -1634,15 +1598,15 @@ int _media_thumb_get_hash_name(const char *file_full_path, } if (store_type == MS_USER_STORAGE_INTERNAL) { - get_path = _media_thumb_phone_get_path(uid); + ret = ms_user_get_default_thumb_store_path(uid, &get_path); 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 == MS_USER_STORAGE_EXTERNAL) { - get_path = _media_thumb_mmc_get_path(uid); + ret = ms_user_get_mmc_thumb_store_path(uid, &get_path); 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 { - get_path = _media_thumb_phone_get_path(uid); + ret = ms_user_get_default_thumb_store_path(uid, &get_path); if (get_path != NULL) ret_len = snprintf(thumb_hash_path, max_thumb_path - 1, "%s/.%s-%s.jpg", get_path, file_ext, hash_name); } |