summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-08-07 09:40:46 +0900
committerMinje Ahn <minje.ahn@samsung.com>2015-08-07 10:10:15 +0900
commit7adbb6954d7f05fd02b9cded3741ce6ed2c9226b (patch)
tree5315a9e75f2283f559b18a8375f093b6eca10a3e /src/include
parent41f405edc8f31d877615c580ed6eb308d7eaebec (diff)
downloadlibmedia-thumbnail-fa0e2f0b4c21b6507081e580efb70cbadea9176b.tar.gz
libmedia-thumbnail-fa0e2f0b4c21b6507081e580efb70cbadea9176b.tar.bz2
libmedia-thumbnail-fa0e2f0b4c21b6507081e580efb70cbadea9176b.zip
Separate CMakeFiles for apply fPIE option Remove unused code Remove thumb_type Modify jpeg thumbnail creation logic when exif thumbnail is smaller than request thumbnail size Add scale down logic when request huge size image Fix bugs, memory leaks Remove unused parameters in function Change thumb path creation API position Remove thumbnail folder creation API Rename some functions Change-Id: I0e13d393dd524b61bcf44722c33b6f270649b732 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src/include')
-rwxr-xr-x[-rw-r--r--]src/include/codec/AGifFrameInfo.h4
-rwxr-xr-x[-rw-r--r--]src/include/codec/img-codec-common.h27
-rwxr-xr-x[-rw-r--r--]src/include/codec/img-codec-parser.h25
-rwxr-xr-x[-rw-r--r--]src/include/codec/img-codec.h2
-rwxr-xr-xsrc/include/ipc/media-thumb-ipc.h4
-rwxr-xr-xsrc/include/media-thumb-internal.h15
-rwxr-xr-xsrc/include/util/media-thumb-db.h2
-rwxr-xr-xsrc/include/util/media-thumb-util.h17
8 files changed, 44 insertions, 52 deletions
diff --git a/src/include/codec/AGifFrameInfo.h b/src/include/codec/AGifFrameInfo.h
index 0f5aa81..e9c69b8 100644..100755
--- a/src/include/codec/AGifFrameInfo.h
+++ b/src/include/codec/AGifFrameInfo.h
@@ -55,8 +55,8 @@ typedef struct tagFrameInfo
unsigned short delay;
#ifdef INTERNAL_IMGCODEC
- unsigned int nRepeatCount;
- unsigned int nLoopCount;
+ int nRepeatCount;
+ int nLoopCount;
unsigned char bOneFrame;
#endif
diff --git a/src/include/codec/img-codec-common.h b/src/include/codec/img-codec-common.h
index 4cb8922..91887f5 100644..100755
--- a/src/include/codec/img-codec-common.h
+++ b/src/include/codec/img-codec-common.h
@@ -37,19 +37,20 @@ extern "C" {
#define IMG_MAX_IMAGE_FILE_SIZE (10 * 1024 * 1024)
//////////////////////////////////////////////////////////////
+#if 0
#define ImgDebug(type, fmt, arg...) \
do { \
fprintf(stderr, "[Media-SVC]"fmt, ##arg); \
}while(0)
-
-#if 1
+
+
#define SysRequireEx(expr, retValue) \
if (!(expr)) { \
fprintf(stderr, "[Media-SVC][%s] INVALID_PARAM (%d lines in %s)\n",__FUNCTION__, __LINE__, __FILE__); \
return (retValue); \
}
-#define SysDebug(X) ImgDebug X
-
+#define SysDebug(X) ImgDebug X
+
#define SysAssert(expr)
#else
#define SysRequireEx(expr, retValue)
@@ -73,24 +74,6 @@ typedef enum
IMG_INFO_MEM_ALLOC_FAIL = -6
}ImgFastCodecInfo;
-
-
-typedef enum
-{
- IMG_CODEC_UNKNOWN_TYPE = -2,
- IMG_CODEC_BIG_PROGRESSIVE_JPEG = -1,
- IMG_CODEC_NONE = 0,
- IMG_CODEC_GIF = ( 1 << 0),
- IMG_CODEC_PNG = ( 1 << 1),
- IMG_CODEC_WBMP = ( 1 << 2),
- IMG_CODEC_JPEG = ( 1 << 3),
- IMG_CODEC_BMP = ( 1 << 4),
- IMG_CODEC_TIF = ( 1 << 5),
- IMG_CODEC_AGIF = ( 1 << 6),
- IMG_CODEC_PROGRESSIVE_JPEG = ( 1 << 7),
- IMG_CODEC_DRM = ( 1 << 8),
-} ImgCodecType;
-
typedef enum inputFlag
{
IMG_RGB_888_OUTPUT = 0x0001,
diff --git a/src/include/codec/img-codec-parser.h b/src/include/codec/img-codec-parser.h
index 097f24d..b412416 100644..100755
--- a/src/include/codec/img-codec-parser.h
+++ b/src/include/codec/img-codec-parser.h
@@ -30,15 +30,32 @@ extern "C" {
#define PNG_HEADER_LENGTH 8
#define JPG_HEADER_LENGTH 2
-#define GIF_HEADER_LENGTH 3
+#define GIF_HEADER_LENGTH 3
#define TIFF_HEADER_LENGTH 2
#define BMP_HEADER_LENGTH 2
+#define WBMP_HEADER_LENGTH 2
#define TIFF_IMAGE_WIDTH 0x100
#define TIFF_IMAGE_HEIGHT 0x101
-ImgCodecType ImgGetInfo(unsigned char* pEncodedData, unsigned long fileSize, ImgImageInfo* imgInfo);
-ImgCodecType ImgGetInfoFile(const char*filePath, ImgImageInfo *imgInfo);
-ImgCodecType ImgGetInfoHFile(HFile hFile, unsigned long fileSize, ImgImageInfo* imgInfo);
+typedef enum
+{
+ IMG_CODEC_UNKNOWN_TYPE = -2,
+ IMG_CODEC_BIG_PROGRESSIVE_JPEG = -1,
+ IMG_CODEC_NONE = 0,
+ IMG_CODEC_GIF = ( 1 << 0),
+ IMG_CODEC_PNG = ( 1 << 1),
+ IMG_CODEC_WBMP = ( 1 << 2),
+ IMG_CODEC_JPEG = ( 1 << 3),
+ IMG_CODEC_BMP = ( 1 << 4),
+ IMG_CODEC_TIF = ( 1 << 5),
+ IMG_CODEC_AGIF = ( 1 << 6),
+ IMG_CODEC_PROGRESSIVE_JPEG = ( 1 << 7),
+ IMG_CODEC_DRM = ( 1 << 8),
+} ImgCodecType;
+
+//ImgCodecType ImgGetInfoFile(const char*filePath, ImgImageInfo *imgInfo);
+int ImgGetImageInfo(const char *filePath, ImgCodecType *type, unsigned int *width, unsigned int *height);
+int ImgGetImageInfoForThumb(const char *filePath, ImgCodecType *type, unsigned int *width, unsigned int *height);
#ifdef __cplusplus
}
diff --git a/src/include/codec/img-codec.h b/src/include/codec/img-codec.h
index 708c5ce..d365705 100644..100755
--- a/src/include/codec/img-codec.h
+++ b/src/include/codec/img-codec.h
@@ -30,7 +30,7 @@
extern "C" {
#endif /* __cplusplus */
-unsigned int* ImgGetFirstFrameAGIFAtSize(const char *szFileName, ImgImageInfo *image_info);
+unsigned int* ImgGetFirstFrameAGIFAtSize(const char *szFileName, unsigned int width, unsigned int height);
int ImgConvertRGB565ToRGB888(void *pBuf_rgb565, void **pBuf_rgb888, int width, int height);
diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h
index fcd4560..7251ed9 100755
--- a/src/include/ipc/media-thumb-ipc.h
+++ b/src/include/ipc/media-thumb-ipc.h
@@ -30,8 +30,6 @@
#include <signal.h>
#include <sys/types.h>
-#include "media-thumb-debug.h"
-#include "media-thumb-types.h"
#include "media-thumb-internal.h"
#include "media-util-ipc.h"
#include "media-server-ipc.h"
@@ -72,7 +70,6 @@ int _media_thumb_set_buffer_for_response(thumbMsg *req_msg, unsigned char **buf,
int _media_thumb_set_add_raw_data_buffer(thumbRawAddMsg *req_msg, unsigned char **buf, int *buf_size);
int _media_thumb_request(int msg_type,
- media_thumb_type thumb_type,
const char *origin_path,
char *thumb_path,
int max_length,
@@ -80,7 +77,6 @@ int _media_thumb_request(int msg_type,
uid_t uid);
int _media_thumb_request_async(int msg_type,
- media_thumb_type thumb_type,
const char *origin_path,
thumbUserData *userData,
uid_t uid);
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h
index ad50b04..b059658 100755
--- a/src/include/media-thumb-internal.h
+++ b/src/include/media-thumb-internal.h
@@ -23,8 +23,6 @@
#include <media-util-err.h>
#include "media-thumbnail.h"
#include "media-thumb-util.h"
-#include "media-thumb-types.h"
-#include "media-thumb-debug.h"
#ifndef _MEDIA_THUMB_INTERNAL_H_
#define _MEDIA_THUMB_INTERNAL_H_
@@ -44,8 +42,9 @@ typedef struct {
int height;
int origin_width;
int origin_height;
- gboolean alpha;
+ int alpha;
unsigned char *data;
+ bool is_saved;
} media_thumb_info;
enum Exif_Orientation {
@@ -71,21 +70,21 @@ typedef struct {
} thumbRawUserData;
int _media_thumb_image(const char *origin_path,
+ const char *thumb_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
media_thumb_info *thumb_info,
- bool is_raw,
- uid_t uid);
+ bool is_req_raw);
int _media_thumb_video(const char *origin_path,
int thumb_width,
int thumb_height,
media_thumb_format format,
- media_thumb_info *thumb_info,
- uid_t uid);
+ media_thumb_info *thumb_info);
-int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
+int _media_thumb_get_hash_name(const char *file_full_path,
+ char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
int _media_thumb_save_to_file_with_evas(unsigned char *data,
int w,
diff --git a/src/include/util/media-thumb-db.h b/src/include/util/media-thumb-db.h
index fcd284f..23ac277 100755
--- a/src/include/util/media-thumb-db.h
+++ b/src/include/util/media-thumb-db.h
@@ -21,8 +21,6 @@
#include <sqlite3.h>
#include <media-util.h>
-#include "media-thumb-types.h"
-#include "media-thumb-debug.h"
#ifndef _MEDIA_THUMB_DB_H_
#define _MEDIA_THUMB_DB_H_
diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h
index 3bb71df..de6d9f6 100755
--- a/src/include/util/media-thumb-util.h
+++ b/src/include/util/media-thumb-util.h
@@ -19,8 +19,6 @@
*
*/
-#include "media-thumb-types.h"
-#include "media-thumb-debug.h"
#include "media-util.h"
#include <tzplatform_config.h>
@@ -28,6 +26,13 @@
#define _MEDIA_THUMB_UTIL_H_
#define SAFE_FREE(src) { if(src) {free(src); src = NULL;}}
+#define THUMB_MALLOC(src, size) { if (size <= 0) {src = NULL;} \
+ else { src = malloc(size); if(src) memset(src, 0x0, size);} }
+
+typedef enum {
+ MEDIA_THUMB_BGRA, /* BGRA, especially provided for evas users */
+ MEDIA_THUMB_RGB888, /* RGB888 */
+} media_thumb_format;
#define THUMB_NONE_TYPE -1 /* None */
#define THUMB_IMAGE_TYPE 0 /* Image */
@@ -47,23 +52,17 @@ typedef enum
THUMB_MMC /**< Stored only in MMC */
} media_thumb_store_type;
-int _media_thumb_get_length(media_thumb_type thumb_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);
-int _media_thumb_remove_file(const char *path);
-
char* _media_thumb_generate_hash_name(const char *file);
int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
-int _media_thumb_get_width(media_thumb_type thumb_type);
-
-int _media_thumb_get_height(media_thumb_type thumb_type);
+int _media_thumb_remove_file(const char *path);
#endif /*_MEDIA_THUMB_UTIL_H_*/