summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaejeong Kim <backto.kim@samsung.com>2017-09-07 01:21:08 (GMT)
committerHaejeong Kim <backto.kim@samsung.com>2017-09-07 01:21:25 (GMT)
commit60e9a7c4abddbf140b7aefb650854f7a83f5bd62 (patch)
tree50e2490f26019740b5b0245b551bb8731195b9b5
parent033c47246776bcf23ce24d5328f8b7f17162bdaf (diff)
parentf621258d843be4b8ced15372dbfd088ecfa9949b (diff)
downloadlibmedia-thumbnail-accepted/tizen/4.0/unified/20170907.195904.zip
libmedia-thumbnail-accepted/tizen/4.0/unified/20170907.195904.tar.gz
libmedia-thumbnail-accepted/tizen/4.0/unified/20170907.195904.tar.bz2
Change-Id: I3fda67a1fdd5333587feea79836fb3f9f8019d5a
-rwxr-xr-xCMakeLists.txt2
-rwxr-xr-x[-rw-r--r--]md5/md5.h8
-rwxr-xr-x[-rw-r--r--]md5/media-thumb-hash.c2
-rw-r--r--packaging/libmedia-thumbnail.spec2
-rwxr-xr-xsrc/codec/img-codec-parser.c5
-rwxr-xr-xsrc/codec/img-codec.c9
-rwxr-xr-xsrc/include/util/media-thumb-debug.h22
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c4
-rwxr-xr-xsrc/media-thumb-internal.c3
-rwxr-xr-xsrc/media-thumbnail.c4
-rwxr-xr-xsrc/util/media-thumb-debug.c108
11 files changed, 16 insertions, 153 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6eb775a..821871a 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,6 @@ SET(MEDIATHUMB-LIB "media-thumbnail")
SET(MEDIAHASH-LIB "media-hash")
SET(SRCS
src/media-thumbnail.c
- src/util/media-thumb-debug.c
src/util/media-thumb-util.c
src/ipc/media-thumb-ipc.c
src/codec/IfegDecodeAGIF.c
@@ -61,7 +60,6 @@ ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"")
ADD_DEFINITIONS("-DPACKAGE_NAME=\"${PKGNAME}\"")
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
ADD_DEFINITIONS("-D_GNU_SOURCE")
-#ADD_DEFINITIONS("-D_PERFORMANCE_CHECK_")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--hash-style=both")
CONFIGURE_FILE(media-thumbnail.pc.in media-thumbnail.pc @ONLY)
diff --git a/md5/md5.h b/md5/md5.h
index 7cc0a35..72c9994 100644..100755
--- a/md5/md5.h
+++ b/md5/md5.h
@@ -30,9 +30,9 @@ typedef struct MD5Context {
unsigned char in[64];
} MD5_CTX;
-extern void media_thumb_MD5Init(MD5_CTX *context);
-extern void media_thumb_MD5Update(MD5_CTX *context,unsigned char const *buf,unsigned len);
-extern void media_thumb_MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
-extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
+extern void media_thumb_MD5Init(MD5_CTX *context);
+extern void media_thumb_MD5Update(MD5_CTX *context, unsigned char const *buf, unsigned len);
+extern void media_thumb_MD5Final(unsigned char digest[MD5_HASHBYTES], MD5_CTX *context);
+extern void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
#endif
diff --git a/md5/media-thumb-hash.c b/md5/media-thumb-hash.c
index abd4fda..b0a94f7 100644..100755
--- a/md5/media-thumb-hash.c
+++ b/md5/media-thumb-hash.c
@@ -104,4 +104,4 @@ char *_media_thumb_generate_hash_name(const char *file)
md5out[2 * n] = '\0';
return md5out;
-} \ No newline at end of file
+}
diff --git a/packaging/libmedia-thumbnail.spec b/packaging/libmedia-thumbnail.spec
index 27a0c47..cab076b 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.15
+Version: 0.2.16
Release: 0
Group: Multimedia/Libraries
License: Apache-2.0 and PD
diff --git a/src/codec/img-codec-parser.c b/src/codec/img-codec-parser.c
index 70f9587..75f0a06 100755
--- a/src/codec/img-codec-parser.c
+++ b/src/codec/img-codec-parser.c
@@ -23,11 +23,6 @@
#include <stdlib.h>
#include <string.h>
-#if defined(_PERFORMANCE_CHECK_)
-#include <time.h>
-#include <sys/time.h>
-#endif
-
#include <media-util-err.h>
#include "media-thumb-debug.h"
#include "img-codec-common.h"
diff --git a/src/codec/img-codec.c b/src/codec/img-codec.c
index e87e93f..bebe05b 100755
--- a/src/codec/img-codec.c
+++ b/src/codec/img-codec.c
@@ -20,6 +20,7 @@
*/
#include "media-thumb-debug.h"
+#include "media-thumb-util.h"
#include "img-codec.h"
#include <string.h>
#include <image_util.h>
@@ -48,7 +49,7 @@ unsigned int *ImgGetFirstFrameAGIFAtSize(const char *szFileName,
if (ImgConvertRGB565ToRGB888(pFrameInfo->pOutBits, &pDecodedRGB888Buf, pFrameInfo->width, pFrameInfo->height)) {
if (pDecodedRGB888Buf) {
- free(pFrameInfo->pOutBits);
+ SAFE_FREE(pFrameInfo->pOutBits);
pFrameInfo->pOutBits = pDecodedRGB888Buf;
unsigned char *src = ((unsigned char *)(pFrameInfo->pOutBits));
@@ -172,11 +173,7 @@ AGifFrameInfo *ImgCreateAGIFFrame(const char *szFileName, unsigned int width, un
if (DrmReadFile(hFile, pEncodedData, mem_alloc_size, &size) == FALSE) {
thumb_err("DrmReadFile was failed");
DrmCloseFile(hFile);
-
- if (pEncodedData) {
- free(pEncodedData);
- pEncodedData = NULL;
- }
+ SAFE_FREE(pEncodedData);
return NULL;
}
diff --git a/src/include/util/media-thumb-debug.h b/src/include/util/media-thumb-debug.h
index 9cfbe2d..82deeb0 100755
--- a/src/include/util/media-thumb-debug.h
+++ b/src/include/util/media-thumb-debug.h
@@ -83,7 +83,7 @@
} while (0)
#define thumb_retv_if(expr, val) do { \
if (expr) { \
- LOGE(FONT_COLOR_RED""FONT_COLOR_RESET); \
+ LOGE(FONT_COLOR_RED""FONT_COLOR_RESET); \
return (val); \
} \
} while (0)
@@ -94,25 +94,5 @@
} \
} while (0)
-#ifdef _USE_LOG_FILE_
-void thumb_init_file_debug();
-void thumb_close_file_debug();
-FILE* get_fp();
-#define thumb_file_dbg(fmt, arg...) fprintf(get_fp(), "[%s: %d] " fmt "\n", __FUNCTION__, __LINE__, ##arg)
-
-#endif
-
-
-#ifdef _PERFORMANCE_CHECK_
-long
-thumb_get_debug_time(void);
-void
-thumb_reset_debug_time(void);
-void
-thumb_print_debug_time(char* time_string);
-void
-thumb_print_debug_time_ex(long start, long end, const char* func_name, char* time_string);
-#endif
-
#endif /*_MEDIA_THUMB_DEBUG_H_*/
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 46f7ae8..3e8ccec 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -754,7 +754,7 @@ int _media_thumb_request_async(int msg_type, unsigned int request_id, const char
thumb_req->path = g_strdup(origin_path);
thumb_req->userData = userData;
thumb_req->isCanceled = false;
- thumb_req->isRequested= false;
+ thumb_req->isRequested = false;
thumb_req->request_id = request_id;
thumb_req->uid = uid;
@@ -792,7 +792,7 @@ int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char
thumb_req->height = height;
thumb_req->userData = userData;
thumb_req->isCanceled = false;
- thumb_req->isRequested= false;
+ thumb_req->isRequested = false;
thumb_req->uid = uid;
len = g_queue_get_length(g_manage_raw_queue);
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index f9ad343..c6c4a57 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -594,6 +594,7 @@ int _media_thumb_get_thumb_from_exif(ExifData *ed,
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_rotate_thumb falied: %d", err);
SAFE_FREE(thumb_info->data);
+ SAFE_FREE(raw_image);
return err;
}
@@ -1200,7 +1201,7 @@ int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path
_media_thumb_get_file_ext(file_full_path, file_ext, sizeof(file_ext));
ret = ms_user_get_storage_type(uid, file_full_path, &storage_type);
- if((ret != MS_MEDIA_ERR_NONE) || ((storage_type != MS_USER_STORAGE_INTERNAL) && (storage_type != MS_USER_STORAGE_EXTERNAL))) {
+ if ((ret != MS_MEDIA_ERR_NONE) || ((storage_type != MS_USER_STORAGE_INTERNAL) && (storage_type != MS_USER_STORAGE_EXTERNAL))) {
thumb_err_slog("origin path(%s) is invalid. err : [%d] storage_type [%d]", file_full_path, ret, storage_type);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 8a4645f..2fb3065 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -49,7 +49,7 @@ int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max
ms_user_storage_type_e store_type = -1;
err = ms_user_get_storage_type(uid, origin_path, &store_type);
- if((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
+ if ((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
thumb_err_slog("origin path(%s) is invalid. err : [%d] store_type [%d]", origin_path, err, store_type);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
@@ -83,7 +83,7 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_
ms_user_storage_type_e store_type = -1;
err = ms_user_get_storage_type(uid, origin_path, &store_type);
- if((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
+ if ((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
thumb_err_slog("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-debug.c b/src/util/media-thumb-debug.c
deleted file mode 100755
index f293afd..0000000
--- a/src/util/media-thumb-debug.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * 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.
- *
- */
-
-#include <unistd.h>
-#include <asm/unistd.h>
-#include <time.h>
-#include <sys/time.h>
-#include "media-thumb-debug.h"
-
-#ifdef _PERFORMANCE_CHECK_
-static long g_time_usec = 0L;
-
-
-#ifdef _USE_LOG_FILE_
-static FILE *g_log_fp = NULL;
-static char _g_file_path[1024] = "\0";
-
-FILE *get_fp()
-{
- return g_log_fp;
-}
-
-void thumb_init_file_debug()
-{
- if (g_log_fp == NULL) {
- snprintf(_g_file_path, sizeof(_g_file_path), "/tmp/%s",
- "media-thumb.log");
- if (access(_g_file_path, R_OK == 0)) {
- remove(_g_file_path);
- }
-
- g_log_fp = fopen(_g_file_path, "a");
- }
-}
-
-void thumb_close_file_debug()
-{
- if (g_log_fp != NULL) {
- fclose(g_log_fp);
- g_log_fp = NULL;
- }
-}
-
-#endif
-
-long thumb_get_debug_time(void)
-{
-#ifdef _PERFORMANCE_CHECK_
- struct timeval time;
- gettimeofday(&time, NULL);
- return time.tv_sec * 1000000 + time.tv_usec;
-#else
- return 0L;
-#endif
-}
-
-void thumb_reset_debug_time(void)
-{
-#ifdef _PERFORMANCE_CHECK_
- struct timeval time;
- gettimeofday(&time, NULL);
- g_time_usec = time.tv_sec * 1000000 + time.tv_usec;
-#endif
-}
-
-void thumb_print_debug_time(char *time_string)
-{
-#ifdef _PERFORMANCE_CHECK_
- struct timeval time;
- double totaltime = 0.0;
-
- gettimeofday(&time, NULL);
- totaltime = (double)(time.tv_sec * 1000000 + time.tv_usec - g_time_usec) / CLOCKS_PER_SEC;
-
- thumb_dbg("time [%s] : %f", time_string, totaltime);
-#endif
-}
-
-void
-thumb_print_debug_time_ex(long start, long end, const char *func_name, char *time_string)
-{
-#ifdef _PERFORMANCE_CHECK_
- double totaltime = 0.0;
-
- totaltime = (double)(end - start) / CLOCKS_PER_SEC;
-
- thumb_dbg("time [%s: %s] : %f", func_name, time_string, totaltime);
-#endif
-}
-#endif \ No newline at end of file