summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2017-06-07 06:46:18 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2017-06-08 05:08:18 (GMT)
commit75c4bd5f2433f484a974b913d9e58cf5f5cdb187 (patch)
treef540a33e9b4d0e47f670ae93a51fa9890fdc9598 /server
parent34ed08a8f899bffe2f9b27b4bd2e6e180650e61c (diff)
downloadlibmedia-thumbnail-75c4bd5f2433f484a974b913d9e58cf5f5cdb187.zip
libmedia-thumbnail-75c4bd5f2433f484a974b913d9e58cf5f5cdb187.tar.gz
libmedia-thumbnail-75c4bd5f2433f484a974b913d9e58cf5f5cdb187.tar.bz2
Remove format enum and related API Remove unused codes Merge same logics Change-Id: I1e44585955eb1698d2aa5901f2e1969d831de6c7 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'server')
-rwxr-xr-xserver/include/thumb-server-internal.h2
-rwxr-xr-xserver/thumb-server-internal.c73
2 files changed, 22 insertions, 53 deletions
diff --git a/server/include/thumb-server-internal.h b/server/include/thumb-server-internal.h
index 3dedd77..6ec539a 100755
--- a/server/include/thumb-server-internal.h
+++ b/server/include/thumb-server-internal.h
@@ -43,7 +43,6 @@ gboolean _thumb_server_prepare_socket(int *sock_fd);
gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpointer data);
int _thumbnail_get_data(const char *origin_path,
- media_thumb_format format,
char *thumb_path,
unsigned char **data,
int *size,
@@ -55,7 +54,6 @@ int _thumbnail_get_data(const char *origin_path,
bool *is_saved);
int _thumbnail_get_raw_data(const char *origin_path,
- media_thumb_format format,
int *width,
int *height,
unsigned char **data,
diff --git a/server/thumb-server-internal.c b/server/thumb-server-internal.c
index dc921d6..58c8c76 100755
--- a/server/thumb-server-internal.c
+++ b/server/thumb-server-internal.c
@@ -78,20 +78,15 @@ int _thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg)
{
int err = MS_MEDIA_ERR_NONE;
- err = _media_thumb_process(req_msg, res_msg);
- if (err != MS_MEDIA_ERR_NONE)
- thumb_warn("_media_thumb_process is failed: %d", err);
-
- return err;
-}
-
-static int __thumb_daemon_process_job_raw(thumbMsg *req_msg, thumbMsg *res_msg)
-{
- int err = MS_MEDIA_ERR_NONE;
-
- err = _media_thumb_process_raw(req_msg, res_msg);
- if (err != MS_MEDIA_ERR_NONE)
- thumb_warn("_media_thumb_process_raw is failed: %d", err);
+ if (req_msg->msg_type == THUMB_REQUEST_RAW_DATA) {
+ err = _media_thumb_process_raw(req_msg, res_msg);
+ if (err != MS_MEDIA_ERR_NONE)
+ thumb_warn("_media_thumb_process_raw is failed: %d", err);
+ } else {
+ err = _media_thumb_process(req_msg, res_msg);
+ if (err != MS_MEDIA_ERR_NONE)
+ thumb_warn("_media_thumb_process is failed: %d", err);
+ }
return err;
}
@@ -146,13 +141,8 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
thumb_warn_slog("Received [%d] %s(%d) from PID(%d)", recv_msg.msg_type, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
- if (recv_msg.msg_type == THUMB_REQUEST_RAW_DATA) {
- __thumb_daemon_process_job_raw(&recv_msg, &res_msg);
- } else if (recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
- thumb_warn("received KILL msg from thumbnail agent.");
- } else {
+ if (recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER)
_thumb_daemon_process_job(&recv_msg, &res_msg);
- }
if (res_msg.msg_type == 0)
res_msg.msg_type = recv_msg.msg_type;
@@ -186,9 +176,9 @@ gboolean _thumb_server_read_socket(GIOChannel *src,
block_size = THUMB_BLOCK_SIZE;
}
}
- if (buf_size == 0) {
- thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
- }
+
+ thumb_dbg_slog("Sent data(%d) from %s", res_msg.thumb_size, res_msg.org_path);
+
SAFE_FREE(buf);
SAFE_FREE(res_msg.thumb_data);
@@ -277,7 +267,6 @@ gboolean _thumb_server_prepare_socket(int *sock_fd)
}
int _thumbnail_get_data(const char *origin_path,
- media_thumb_format format,
char *thumb_path,
unsigned char **data,
int *size,
@@ -292,23 +281,16 @@ int _thumbnail_get_data(const char *origin_path,
int thumb_width = -1;
int thumb_height = -1;
- if (origin_path == NULL || size == NULL
- || width == NULL || height == NULL) {
+ if (origin_path == NULL || size == NULL || width == NULL || height == NULL) {
thumb_err("Invalid parameter");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (format < MEDIA_THUMB_BGRA || format > MEDIA_THUMB_RGB888) {
- thumb_err("parameter format is invalid");
+ if (!g_file_test(origin_path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR)) {
+ thumb_err("Original path (%s) does not exist", origin_path);
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) does not exist", origin_path);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
thumb_dbg("Origin path : %s", origin_path);
int file_type = THUMB_NONE_TYPE;
@@ -324,13 +306,13 @@ int _thumbnail_get_data(const char *origin_path,
thumb_info.is_raw = FALSE;
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
@@ -355,7 +337,6 @@ int _thumbnail_get_data(const char *origin_path,
}
int _thumbnail_get_raw_data(const char *origin_path,
- media_thumb_format format,
int *width,
int *height,
unsigned char **data,
@@ -371,11 +352,6 @@ int _thumbnail_get_raw_data(const char *origin_path,
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- if (format < MEDIA_THUMB_BGRA || format > MEDIA_THUMB_RGB888) {
- thumb_err("parameter format is invalid");
- 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) does not exist", origin_path);
return MS_MEDIA_ERR_INVALID_PARAMETER;
@@ -389,13 +365,13 @@ int _thumbnail_get_raw_data(const char *origin_path,
thumb_info.is_raw = TRUE;
if (file_type == THUMB_IMAGE_TYPE) {
- err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_image(origin_path, thumb_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
}
} else if (file_type == THUMB_VIDEO_TYPE) {
- err = _media_thumb_video(origin_path, thumb_width, thumb_height, format, &thumb_info);
+ err = _media_thumb_video(origin_path, thumb_width, thumb_height, &thumb_info);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_image failed");
return err;
@@ -435,8 +411,6 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
int msg_type = req_msg->msg_type;
const char *origin_path = req_msg->org_path;
-
- media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
thumb_w = req_msg->thumb_width;
thumb_h = req_msg->thumb_height;
thumb_path = res_msg->dst_path;
@@ -488,7 +462,7 @@ int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
_media_thumb_remove_file(thumb_path);
}
- err = _thumbnail_get_data(origin_path, thumb_format, 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, &origin_w, &origin_h, &alpha, &is_saved);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_thumbnail_get_data failed - %d", err);
SAFE_FREE(data);
@@ -584,14 +558,11 @@ _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg)
}
const char *origin_path = req_msg->org_path;
-
- media_thumb_format thumb_format = MEDIA_THUMB_BGRA;
thumb_w = req_msg->thumb_width;
thumb_h = req_msg->thumb_height;
res_msg->status = MS_MEDIA_ERR_NONE;
- err = _thumbnail_get_raw_data(origin_path, thumb_format, &thumb_w, &thumb_h, &data, &thumb_size);
-
+ err = _thumbnail_get_raw_data(origin_path, &thumb_w, &thumb_h, &data, &thumb_size);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_thumbnail_get_data failed - %d", err);
res_msg->status = err;