#define FONT_COLOR_CYAN "\033[36m"
#define FONT_COLOR_GRAY "\033[37m"
-#define thumbnail_util_gettid() syscall(__NR_gettid)
+#define THUMB_GETTID() syscall(__NR_gettid)
-#define thumbnail_util_retv_if(expr, val) do { \
+#define THUMB_RETV_IF(expr, val) do { \
if (expr) { \
- LOGE(FONT_COLOR_RED"[%ld]"FONT_COLOR_RESET, thumbnail_util_gettid()); \
+ LOGE(FONT_COLOR_RED"[%ld]"FONT_COLOR_RESET, THUMB_GETTID()); \
return (val); \
} \
} while (0)
-#define thumbnail_util_retvm_if(expr, val, fmt, arg...) do { \
+#define THUMB_RETVM_IF(expr, val, fmt, arg...) do { \
if (expr) { \
- LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, thumbnail_util_gettid(), ##arg); \
+ LOGE(FONT_COLOR_RED"[%ld]"fmt""FONT_COLOR_RESET, THUMB_GETTID(), ##arg); \
return (val); \
} \
} while (0)
-#define thumbnail_util_retm_if(expr, fmt, arg...) do { \
- if (expr) { \
- LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
- return; \
- } \
- } while (0)
-
-#define thumbnail_util_warn(fmt, arg...) do { \
+#define THUMB_WARN(fmt, arg...) do { \
LOGW(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
} while (0)
-#define thumbnail_util_debug(fmt, arg...) do { \
+#define THUMB_DBG(fmt, arg...) do { \
LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
} while (0)
-#define thumbnail_util_error(fmt, arg...) do { \
+#define THUMB_ERR(fmt, arg...) do { \
LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
} while (0)
-#define thumbnail_util_sec_debug(fmt, arg...) do { \
+#define THUMB_SDBG(fmt, arg...) do { \
SECURE_LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
} while (0)
-#define thumbnail_util_sec_error(fmt, arg...) do { \
- SECURE_LOGE(FONT_COLOR_RED""fmt""FONT_COLOR_RESET, ##arg); \
- } while (0)
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include <thumbnail_util.h>
#include <thumbnail_util_private.h>
-
-/* For async API */
#include <media-thumbnail.h>
#include <media-util.h>
-
-/* For sync API */
#include <aul.h>
static int __thumbnail_util_error_capi(int internal_error)
// LCOV_EXCL_START
int thumbnail_util_create(thumbnail_h *thumb)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_create() is deprecated and will be removed from next release.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_create() is deprecated and will be removed from next release.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
int thumbnail_util_extract(thumbnail_h thumb, thumbnail_extracted_cb callback, void *user_data, char **request_id)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_extract() is deprecated and will be removed from next release. Use thumbnail_util_extract_to_file() or thumbnail_util_extract_to_buffer() instead.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_extract() is deprecated and will be removed from next release. Use thumbnail_util_extract_to_file() or thumbnail_util_extract_to_buffer() instead.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
int thumbnail_util_set_path(thumbnail_h thumb, const char *path)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_set_path() is deprecated and will be removed from next release.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_set_path() is deprecated and will be removed from next release.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
int thumbnail_util_set_size(thumbnail_h thumb, int width, int height)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_set_size() is deprecated and will be removed from next release.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_set_size() is deprecated and will be removed from next release.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
int thumbnail_util_cancel(thumbnail_h thumb, const char *request_id)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_cancel() is deprecated and will be removed from next release.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_cancel() is deprecated and will be removed from next release.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
int thumbnail_util_destroy(thumbnail_h thumb)
{
- thumbnail_util_warn("DEPRECATION WARNING: thumbnail_util_destroy() is deprecated and will be removed from next release.");
+ THUMB_WARN("DEPRECATION WARNING: thumbnail_util_destroy() is deprecated and will be removed from next release.");
return THUMBNAIL_UTIL_ERROR_NONE;
}
// LCOV_EXCL_STOP
const char *supported_type = "application/vnd.ms-asf";
// Check file is existed
- thumbnail_util_retv_if(path == NULL, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
+ THUMB_RETV_IF(path == NULL, THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER);
if (access(path, R_OK) < 0) {
if (errno == EACCES || errno == EPERM) {
- thumbnail_util_error("Fail to open path: Permission Denied [%s]", path);
+ THUMB_ERR("Fail to open path: Permission Denied [%s]", path);
return THUMBNAIL_UTIL_ERROR_PERMISSION_DENIED;
} else {
- thumbnail_util_error("Fail to open path: Invalid Path [%s]", path);
+ THUMB_ERR("Fail to open path: Invalid Path [%s]", path);
return THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
}
}
// Check media type
ret = aul_get_mime_from_file(path, mimetype, sizeof(mimetype));
- thumbnail_util_retvm_if(ret < 0, THUMBNAIL_UTIL_ERROR_INVALID_OPERATION, "aul_get_mime_from_file failed");
+ THUMB_RETVM_IF(ret < 0, THUMBNAIL_UTIL_ERROR_INVALID_OPERATION, "aul_get_mime_from_file failed");
- thumbnail_util_debug("mime type : %s", mimetype);
+ THUMB_DBG("mime type : %s", mimetype);
/* categorize from mimetype */
if (strstr(mimetype, "image") != NULL) {
- thumbnail_util_retvm_if(!strcmp(mimetype, unsupported_type), THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT, "This is unsupport file type");
+ THUMB_RETVM_IF(!strcmp(mimetype, unsupported_type), THUMBNAIL_UTIL_ERROR_UNSUPPORTED_CONTENT, "This is unsupport file type");
*type = THUMBNAIL_UTIL_IMAGE;
return THUMBNAIL_UTIL_ERROR_NONE;
} else if (strstr(mimetype, "video") != NULL) {
/* check media type */
ret = __thumbnail_util_check_media_type(path, &type);
- thumbnail_util_retvm_if(ret != THUMBNAIL_UTIL_ERROR_NONE, ret, "__thumbnail_util_check_media_type failed");
+ THUMB_RETVM_IF(ret != THUMBNAIL_UTIL_ERROR_NONE, ret, "__thumbnail_util_check_media_type failed");
/* If image, check support format */
if (type == THUMBNAIL_UTIL_IMAGE)
/* check media type */
ret = __thumbnail_util_check_media_type(path, &type);
- thumbnail_util_retvm_if(ret != THUMBNAIL_UTIL_ERROR_NONE, ret, "__thumbnail_util_check_media_type failed");
+ THUMB_RETVM_IF(ret != THUMBNAIL_UTIL_ERROR_NONE, ret, "__thumbnail_util_check_media_type failed");
/* If image, check support format */
if (type == THUMBNAIL_UTIL_IMAGE) {
ret = create_image_thumbnail_to_file(path, width, height, thumbnail_path, false);
} else {
if (!g_regex_match_simple("[^/]\\.jpe?g$", thumbnail_path, G_REGEX_CASELESS, 0)) {
- thumbnail_util_error("Unsupported path or extensions [%s]", thumbnail_path);
+ THUMB_ERR("Unsupported path or extensions [%s]", thumbnail_path);
return THUMBNAIL_UTIL_ERROR_INVALID_PARAMETER;
}