summaryrefslogtreecommitdiff
path: root/src/media-thumbnail.c
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2015-08-07 00:40:46 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2015-08-07 01:10:15 (GMT)
commit7adbb6954d7f05fd02b9cded3741ce6ed2c9226b (patch)
tree5315a9e75f2283f559b18a8375f093b6eca10a3e /src/media-thumbnail.c
parent41f405edc8f31d877615c580ed6eb308d7eaebec (diff)
downloadlibmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.zip
libmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.tar.gz
libmedia-thumbnail-7adbb6954d7f05fd02b9cded3741ce6ed2c9226b.tar.bz2
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/media-thumbnail.c')
-rwxr-xr-xsrc/media-thumbnail.c83
1 files changed, 6 insertions, 77 deletions
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 39d2ebf..e5f6c2b 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -24,77 +24,9 @@
#include "media-thumb-util.h"
#include "media-thumb-internal.h"
#include "media-thumb-ipc.h"
-//#include "media-thumb-db.h"
#include <glib.h>
-int thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid)
-{
- int err = MS_MEDIA_ERR_NONE;
- //int need_update_db = 0;
- media_thumb_info thumb_info;
-
- if (origin_path == NULL || thumb_path == NULL) {
- thumb_err("Invalid parameter");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (!g_file_test
- (origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
- thumb_err("Original path(%s) doesn't exist.", origin_path);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (max_length <= 0) {
- thumb_err("Length is invalid");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- int store_type = -1;
- store_type = _media_thumb_get_store_type_by_path(origin_path);
-
- if ((store_type != THUMB_PHONE) && (store_type != THUMB_MMC)) {
- thumb_err("origin path(%s) is invalid", origin_path);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- thumb_dbg_slog("Path : %s", origin_path);
-
- /* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_request failed : %d", err);
- return err;
- }
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int thumbnail_request_save_to_file(const char *origin_path, media_thumb_type thumb_type, const char *thumb_path, uid_t uid)
-{
- int err = MS_MEDIA_ERR_NONE;
-
- if (origin_path == NULL || thumb_path == NULL) {
- thumb_err("Invalid parameter");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- media_thumb_info thumb_info;
- char tmp_thumb_path[MAX_PATH_SIZE + 1] = {0,};
-
- strncpy(tmp_thumb_path, thumb_path, sizeof(tmp_thumb_path));
- tmp_thumb_path[sizeof(tmp_thumb_path) - 1] = '\0';
-
- /* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_SAVE_FILE, thumb_type, origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("_media_thumb_request failed : %d", err);
- return err;
- }
-
- return MS_MEDIA_ERR_NONE;
-}
-
int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *origin_width, int *origin_height, uid_t uid)
{
int err = MS_MEDIA_ERR_NONE;
@@ -133,7 +65,7 @@ int thumbnail_request_from_db_with_size(const char *origin_path, char *thumb_pat
thumb_dbg_slog("Path : %s", origin_path);
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
+ err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, origin_path, thumb_path, max_length, &thumb_info, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -150,12 +82,11 @@ int thumbnail_request_extract_all_thumbs(uid_t uid)
int err = MS_MEDIA_ERR_NONE;
media_thumb_info thumb_info;
- media_thumb_type thumb_type = MEDIA_THUMB_LARGE;
char tmp_origin_path[MAX_PATH_SIZE] = {0,};
char tmp_thumb_path[MAX_PATH_SIZE] = {0,};
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request(THUMB_REQUEST_ALL_MEDIA, thumb_type, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
+ err = _media_thumb_request(THUMB_REQUEST_ALL_MEDIA, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -194,7 +125,7 @@ int thumbnail_request_from_db_async(const char *origin_path, ThumbFunc func, voi
userData->user_data = user_data;
/* Request for thumb file to the daemon "Thumbnail generator" */
- err = _media_thumb_request_async(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, userData, uid);
+ err = _media_thumb_request_async(THUMB_REQUEST_DB_INSERT, origin_path, userData, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);
SAFE_FREE(userData);
@@ -246,14 +177,12 @@ int thumbnail_request_cancel_media(const char *origin_path, uid_t uid)
{
int err = MS_MEDIA_ERR_NONE;
- media_thumb_type thumb_type = MEDIA_THUMB_LARGE;
-
if (origin_path == NULL) {
thumb_err("Invalid parameter");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA, thumb_type, origin_path, NULL, uid);
+ err = _media_thumb_request_async(THUMB_REQUEST_CANCEL_MEDIA, origin_path, NULL, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);
return err;
@@ -291,9 +220,9 @@ int thumbnail_request_cancel_all(bool is_raw_data, uid_t uid)
/* Request for thumb file to the daemon "Thumbnail generator" */
if(is_raw_data) {
- err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL_RAW_DATA, MEDIA_THUMB_LARGE, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
+ err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL_RAW_DATA, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
} else {
- err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL, MEDIA_THUMB_LARGE, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
+ err = _media_thumb_request(THUMB_REQUEST_CANCEL_ALL, tmp_origin_path, tmp_thumb_path, sizeof(tmp_thumb_path), &thumb_info, uid);
}
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);