From: Minje Ahn Date: Tue, 11 Jul 2017 05:26:16 +0000 (+0900) Subject: Remove original width, height parameters from response msg X-Git-Tag: accepted/tizen/unified/20170717.170049~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F94%2F138094%2F1;p=platform%2Fcore%2Fmultimedia%2Flibmedia-thumbnail.git Remove original width, height parameters from response msg Change-Id: I7b11e8744939e67130826e43708e5474e39ed975 Signed-off-by: Minje Ahn --- diff --git a/include/media-thumbnail.h b/include/media-thumbnail.h index 334b8a3..1f8628f 100755 --- a/include/media-thumbnail.h +++ b/include/media-thumbnail.h @@ -42,7 +42,7 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_ int thumbnail_request_extract_raw_data_async(int request_id, const char *origin_path, int width, int height, ThumbRawFunc func, void *user_data, uid_t uid); -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 thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid); int thumbnail_request_cancel_media(unsigned int request_id, const char *origin_path); diff --git a/server/include/thumb-server-internal.h b/server/include/thumb-server-internal.h index 6ec539a..44b0d16 100755 --- a/server/include/thumb-server-internal.h +++ b/server/include/thumb-server-internal.h @@ -48,8 +48,6 @@ int _thumbnail_get_data(const char *origin_path, int *size, int *width, int *height, - int *origin_width, - int *origin_height, int *alpha, bool *is_saved); diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c index 7dfd897..ef2cb38 100755 --- a/server/thumb-server-internal.c +++ b/server/thumb-server-internal.c @@ -265,8 +265,6 @@ int _thumbnail_get_data(const char *origin_path, int *size, int *width, int *height, - int *origin_width, - int *origin_height, int *alpha, bool *is_saved) { @@ -319,8 +317,6 @@ int _thumbnail_get_data(const char *origin_path, if (width) *width = thumb_info.width; if (height) *height = thumb_info.height; *data = thumb_info.data; - if (origin_width) *origin_width = thumb_info.origin_width; - if (origin_height) *origin_height = thumb_info.origin_height; if (alpha) *alpha = thumb_info.alpha; if (is_saved) *is_saved = thumb_info.is_saved; @@ -389,8 +385,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) int thumb_size = 0; int thumb_w = 0; int thumb_h = 0; - int origin_w = 0; - int origin_h = 0; int max_length = 0; char *thumb_path = NULL; int alpha = 0; @@ -415,10 +409,9 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) return MS_MEDIA_ERR_FILE_NOT_EXIST; } - err = _media_thumb_get_thumb_from_db_with_size(origin_path, thumb_path, max_length, &origin_w, &origin_h, req_msg->uid); + err = _media_thumb_get_thumb_from_db(origin_path, thumb_path, max_length, req_msg->uid); if (err == MS_MEDIA_ERR_NONE) { - res_msg->origin_width = origin_w; - res_msg->origin_height = origin_h; + thumb_dbg_slog("Thumb path : %s", thumb_path); return MS_MEDIA_ERR_NONE; } else { if (strlen(thumb_path) == 0) { @@ -441,7 +434,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) _media_thumb_remove_file(thumb_path); } - err = _thumbnail_get_data(origin_path, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &origin_w, &origin_h, &alpha, &is_saved); + err = _thumbnail_get_data(origin_path, thumb_path, &data, &thumb_size, &thumb_w, &thumb_h, &alpha, &is_saved); if (err != MS_MEDIA_ERR_NONE) { thumb_err("_thumbnail_get_data failed - %d", err); SAFE_FREE(data); @@ -455,8 +448,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg) res_msg->thumb_size = thumb_size; res_msg->thumb_width = thumb_w; res_msg->thumb_height = thumb_h; - res_msg->origin_width = origin_w; - res_msg->origin_height = origin_h; /* If the image is transparent PNG format, make png file as thumbnail of this image */ if (alpha) { diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h index a7cce71..cc021b6 100755 --- a/src/include/ipc/media-thumb-ipc.h +++ b/src/include/ipc/media-thumb-ipc.h @@ -50,7 +50,6 @@ int _media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, int max_length, - media_thumb_info *thumb_info, uid_t uid); int _media_thumb_request_async(int msg_type, diff --git a/src/include/util/media-thumb-db.h b/src/include/util/media-thumb-db.h index 6156d10..c1ccec1 100755 --- a/src/include/util/media-thumb-db.h +++ b/src/include/util/media-thumb-db.h @@ -29,10 +29,10 @@ #define SQLITE3_FINALIZE(x) {if (x != NULL) sqlite3_finalize(x); } #define SQLITE3_SAFE_FREE(x) {if (x != NULL) {sqlite3_free(x); x = NULL; } } -#define SELECT_THUMB_BY_PATH "SELECT thumbnail_path, width, height FROM media WHERE path='%q' AND thumbnail_path IS NOT NULL;" +#define SELECT_THUMB_BY_PATH "SELECT thumbnail_path FROM media WHERE path='%q' AND thumbnail_path IS NOT NULL;" #define UPDATE_THUMB_BY_PATH "UPDATE media SET thumbnail_path = '%q' WHERE path='%q';" -int _media_thumb_get_thumb_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *width, int *height, uid_t uid); +int _media_thumb_get_thumb_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid); int _media_thumb_update_db(const char *origin_path, char *thumb_path, uid_t uid); #endif /*_MEDIA_THUMB_DB_H_*/ diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c index e86658c..9064a7b 100755 --- a/src/ipc/media-thumb-ipc.c +++ b/src/ipc/media-thumb-ipc.c @@ -541,7 +541,7 @@ _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size) } int -_media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, int max_length, media_thumb_info *thumb_info, uid_t uid) +_media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, int max_length, uid_t uid) { int sock = -1; struct sockaddr_un serv_addr; @@ -620,26 +620,20 @@ _media_thumb_request(int msg_type, const char *origin_path, char *thumb_path, in thumb_dbg_slog("recv %s(%d) from thumb daemon is successful", recv_msg.org_path, recv_str_len); close(sock); + SAFE_FREE(recv_msg.thumb_data); if (recv_str_len > max_length) { thumb_err("user buffer is too small. Output's length is %d", recv_str_len); - SAFE_FREE(recv_msg.thumb_data); return MS_MEDIA_ERR_INVALID_PARAMETER; } if (recv_msg.status != MS_MEDIA_ERR_NONE) { thumb_err("Failed to make thumbnail"); - SAFE_FREE(recv_msg.thumb_data); return recv_msg.status; } strncpy(thumb_path, recv_msg.dst_path, max_length); - thumb_info->origin_width = recv_msg.origin_width; - thumb_info->origin_height = recv_msg.origin_height; - - SAFE_FREE(recv_msg.thumb_data); - return MS_MEDIA_ERR_NONE; } diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c index f3ba2bc..b7fa359 100755 --- a/src/media-thumbnail.c +++ b/src/media-thumbnail.c @@ -27,21 +27,15 @@ #include -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 thumbnail_request_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid) { int err = MS_MEDIA_ERR_NONE; - media_thumb_info thumb_info; if (origin_path == NULL || thumb_path == NULL) { thumb_err("Invalid parameter"); return MS_MEDIA_ERR_INVALID_PARAMETER; } - if (origin_width == NULL || origin_height == NULL) { - thumb_err("Invalid parameter ( width or height )"); - 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; @@ -63,15 +57,12 @@ 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, origin_path, thumb_path, max_length, &thumb_info, uid); + err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, origin_path, thumb_path, max_length, uid); if (err != MS_MEDIA_ERR_NONE) { thumb_err("_media_thumb_request failed : %d", err); return err; } - *origin_width = thumb_info.origin_width; - *origin_height = thumb_info.origin_height; - return MS_MEDIA_ERR_NONE; } diff --git a/src/util/media-thumb-db.c b/src/util/media-thumb-db.c index 8527da0..d955a46 100755 --- a/src/util/media-thumb-db.c +++ b/src/util/media-thumb-db.c @@ -27,7 +27,7 @@ #include #include -int _media_thumb_get_thumb_from_db_with_size(const char *origin_path, char *thumb_path, int max_length, int *width, int *height, uid_t uid) +int _media_thumb_get_thumb_from_db(const char *origin_path, char *thumb_path, int max_length, uid_t uid) { int err = MS_MEDIA_ERR_NONE; char *query_string = NULL; @@ -59,8 +59,6 @@ int _media_thumb_get_thumb_from_db_with_size(const char *origin_path, char *thum if (sqlite3_step(stmt) == SQLITE_ROW) { strncpy(thumb_path, (const char *)sqlite3_column_text(stmt, 0), max_length); - *width = sqlite3_column_int(stmt, 1); - *height = sqlite3_column_int(stmt, 2); } else { thumb_err("end of row [%s]", sqlite3_errmsg(db_handle)); SQLITE3_FINALIZE(stmt);