Remove async code related to thumbnail-util 21/280221/6
authorminje.ahn <minje.ahn@samsung.com>
Thu, 25 Aug 2022 08:51:24 +0000 (17:51 +0900)
committerminje.ahn <minje.ahn@samsung.com>
Mon, 29 Aug 2022 05:24:51 +0000 (14:24 +0900)
Some APIs in the thumbnail-util package have been deprecated since 5.0.
So we remove the relevant code.

Related thumbnail-util API:
 - thumbnail_util_extract()
 - thumbnail_util_cancel()

Change-Id: I22d2a5aa066f2af136c1c68440e99f158243dfe7
Signed-off-by: minje.ahn <minje.ahn@samsung.com>
include/media-thumbnail.h
packaging/libmedia-thumbnail.spec
server/thumb-server-internal.c
src/include/ipc/media-thumb-ipc.h
src/include/media-thumb-internal.h
src/ipc/media-thumb-ipc.c
src/media-thumbnail.c

index 395855fbd44776905f2286704ad0e25c4004bdb0..77511c60851d1262e60c25a7961f637236af0f62 100755 (executable)
@@ -35,13 +35,9 @@ extern "C" {
 #define CONTENT_THUMB_DEFAULT_HEIGHT 240
 
 typedef int (*ThumbFunc) (int error_code, char* path, void* data);
-typedef void (*ThumbRawFunc) (int error_code, int request_id, const char* org_path, int thumb_width, int thumb_height, unsigned char* thumb_data, int thumb_size, void* data);
 
 int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_path, ThumbFunc func, void *user_data, uid_t uid);
-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_cancel_media(unsigned int request_id);
-int thumbnail_request_cancel_raw_data(int request_id);
 
 int create_video_thumbnail_to_file(const char *path, unsigned int width, unsigned int height, const char *thumb_path, bool auto_rotate);
 int create_video_thumbnail_to_buffer(const char *path, unsigned int width, unsigned int height, unsigned char **thumb_buffer, size_t *thumb_size, unsigned int *thumb_width, unsigned int *thumb_height, bool auto_rotate, bool is_server_request);
@@ -56,4 +52,3 @@ int create_image_thumbnail_to_buffer(const char *path, unsigned int width, unsig
 #endif
 
 #endif /*_MEDIA_THUMBNAIL_H_*/
-
index ee35ff6bd88754ed7abe356552a46abc936b4254..bdfed4cf2ad1f891b20757c89066cfb87c48a098 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmedia-thumbnail
 Summary:    Media thumbnail service library for multimedia applications
-Version: 0.3.4
+Version: 0.3.5
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0 and PD
index 4f1e5f9fd49b0199389f5cee861f10c8c4e08212..b536ed1047e32ff648778be83f37aba499619444 100755 (executable)
@@ -34,8 +34,6 @@
 #endif
 
 #define LOG_TAG "MEDIA_THUMBNAIL_SERVER"
-#define THUMB_DEFAULT_WIDTH 320
-#define THUMB_DEFAULT_HEIGHT 240
 #define THUMB_COMM_SOCK_PATH tzplatform_mkpath(TZ_SYS_RUN, "media-server/media_ipc_thumbcomm.socket")
 #define THUMB_EMPTY_STR ""
 
@@ -64,29 +62,6 @@ static int __thumbnail_get_data(const char *origin_path, char *thumb_path)
        return err;
 }
 
-static int __thumbnail_get_raw_data(const char *origin_path, unsigned int *width, unsigned int *height, unsigned char **data, size_t *size)
-{
-       int err = MS_MEDIA_ERR_NONE;
-       int file_type = THUMB_NONE_TYPE;
-
-       thumb_retvm_if(!origin_path, MS_MEDIA_ERR_INVALID_PARAMETER, "Original path is null");
-       thumb_retvm_if(!g_file_test(origin_path, G_FILE_TEST_IS_REGULAR), MS_MEDIA_ERR_INVALID_PARAMETER, "Original path(%s) does not exist", origin_path);
-       thumb_dbg_slog("Origin path : %s", origin_path);
-
-       file_type = _media_thumb_get_file_type(origin_path);
-
-       if (file_type == THUMB_IMAGE_TYPE) {
-               err = create_image_thumbnail_to_buffer(origin_path, *width, *height, data, size, width, height);
-       } else if (file_type == THUMB_VIDEO_TYPE) {
-               err = create_video_thumbnail_to_buffer(origin_path, *width, *height, data, size, width, height, true, true);
-       } else {
-               thumb_err("invalid file type");
-               return MS_MEDIA_ERR_THUMB_UNSUPPORTED;
-       }
-
-       return err;
-}
-
 static int __media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg)
 {
        int err = MS_MEDIA_ERR_NONE;
@@ -137,62 +112,10 @@ DB_UPDATE:
        return err;
 }
 
-static int __media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg)
-{
-       int err = MS_MEDIA_ERR_NONE;
-       unsigned char *data = NULL;
-       size_t thumb_size = 0;
-       unsigned int thumb_w = 0;
-       unsigned int thumb_h = 0;
-
-       thumb_retvm_if(!req_msg || !res_msg, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid msg");
-
-       thumb_w = (req_msg->thumb_width > 0) ? req_msg->thumb_width : THUMB_DEFAULT_WIDTH;
-       thumb_h = (req_msg->thumb_height > 0) ? req_msg->thumb_height : THUMB_DEFAULT_HEIGHT;
-
-       res_msg->status = MS_MEDIA_ERR_NONE;
-       res_msg->msg_type = THUMB_RESPONSE_RAW_DATA;
-
-       err = __thumbnail_get_raw_data(req_msg->org_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;
-               res_msg->thumb_size = 0;
-               goto ERROR;
-       }
-
-       res_msg->thumb_width = thumb_w;
-       res_msg->thumb_height = thumb_h;
-       res_msg->thumb_size = thumb_size;
-       res_msg->thumb_data = malloc(thumb_size * sizeof(unsigned char));
-       if (res_msg->thumb_data) {
-               memcpy(res_msg->thumb_data, data, thumb_size);
-       } else {
-               thumb_err("Allocation failed");
-               err = MS_MEDIA_ERR_OUT_OF_MEMORY;
-       }
-
-ERROR:
-       SAFE_FREE(data);
-
-       return err;
-}
-
 static int __thumb_daemon_process_job(thumbMsg *req_msg, thumbMsg *res_msg)
 {
-       int err = MS_MEDIA_ERR_NONE;
-
-       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_err("_media_thumb_process_raw is failed: %d", err);
-       } else if (req_msg->msg_type == THUMB_REQUEST_DB_INSERT) {
-               err = __media_thumb_process(req_msg, res_msg);
-               if (err != MS_MEDIA_ERR_NONE)
-                       thumb_err("_media_thumb_process is failed: %d", err);
-       }
-
-       return err;
+       thumb_retv_if(req_msg->msg_type != THUMB_REQUEST_DB_INSERT, MS_MEDIA_ERR_NONE);
+       return __media_thumb_process(req_msg, res_msg);
 }
 
 static void __thumb_server_send_deny_message(int sockfd)
@@ -254,11 +177,6 @@ gboolean _thumb_server_read_socket(GIOChannel *channel, GIOCondition condition,
        int sock = -1;
        int client_sock = -1;
 
-       int buf_size = 0;
-       int send_len = 0;
-       int send_pos = 0;
-       unsigned char *buf = NULL;
-
        memset((void *)&recv_msg, 0, sizeof(recv_msg));
        memset((void *)&res_msg, 0, sizeof(res_msg));
        memset((void *)&credentials, 0, sizeof(credentials));
@@ -278,13 +196,7 @@ gboolean _thumb_server_read_socket(GIOChannel *channel, GIOCondition condition,
                goto ERROR;
        }
 
-       if (recv_msg.msg_type != THUMB_REQUEST_KILL_SERVER) {
-               if (ms_cynara_check(&credentials, MEDIA_STORAGE_PRIVILEGE) != MS_MEDIA_ERR_NONE) {
-                       thumb_err("Cynara denied access to process request");
-                       __thumb_server_send_deny_message(client_sock);
-                       goto ERROR;
-               }
-       } else {
+       if (recv_msg.msg_type == THUMB_REQUEST_KILL_SERVER) {
                thumb_warn("Shutting down...");
                g_main_loop_quit(thumb_server);
                close(client_sock);
@@ -292,35 +204,25 @@ gboolean _thumb_server_read_socket(GIOChannel *channel, GIOCondition condition,
                return G_SOURCE_REMOVE;
        }
 
+       if (ms_cynara_check(&credentials, MEDIA_STORAGE_PRIVILEGE) != MS_MEDIA_ERR_NONE) {
+               thumb_err("Cynara denied access to process request");
+               __thumb_server_send_deny_message(client_sock);
+               goto ERROR;
+       }
+
        SAFE_FREE(credentials.smack);
        SAFE_FREE(credentials.uid);
 
        thumb_warn_slog("Received [%d] %.*s(%zu) from PID(%d)", recv_msg.msg_type, MAX_FILEPATH_LEN, recv_msg.org_path, strlen(recv_msg.org_path), recv_msg.pid);
 
        __thumb_daemon_process_job(&recv_msg, &res_msg);
-
        if (res_msg.msg_type == 0)
                res_msg.msg_type = recv_msg.msg_type;
        res_msg.request_id = recv_msg.request_id;
        SAFE_STRLCPY(res_msg.org_path, recv_msg.org_path, sizeof(res_msg.org_path));
-       if (res_msg.msg_type != THUMB_RESPONSE_RAW_DATA)
-               res_msg.thumb_size = 0;
-       else
-               res_msg.dst_path[0] = '\0';
 
-       _media_thumb_set_buffer(&res_msg, &buf, &buf_size);
-
-       while (buf_size > 0) {
-               if ((send_len = send(client_sock, buf + send_pos, buf_size, 0)) < 0) {
-                       thumb_stderror("send failed");
-                       break;
-               }
-               send_pos += send_len;
-               buf_size -= send_len;
-       }
-
-       SAFE_FREE(buf);
-       SAFE_FREE(res_msg.thumb_data);
+       if (send(client_sock, &res_msg, sizeof(res_msg), 0) < 0)
+               thumb_stderror("send failed");
 
 ERROR:
        close(client_sock);
index b242b8e03f60483c1a52db70517134e8cad08ba6..58d58fcb174cf4603b6851c749c176f0690021d6 100755 (executable)
 #ifndef _MEDIA_THUMB_IPC_H_
 #define _MEDIA_THUMB_IPC_H_
 
-#define MAX_PATH_SIZE 4096
-
-int _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size);
-
 int _media_thumb_request_async(int msg_type, unsigned int request_id, const char *origin_path, thumbUserData *userData, uid_t uid);
 
-int _media_thumb_request_raw_data_async(int msg_type,
-                                       int request_id,
-                                       const char *origin_path,
-                                       int width,
-                                       int height,
-                                       thumbRawUserData *userData,
-                                       uid_t uid);
-
 #endif /*_MEDIA_THUMB_IPC_H_*/
index 530f664c829c985de55562a569aeb9fe0b40f051..175dd123d449b8d60b209ac1725d6bcff6092af8 100755 (executable)
@@ -31,11 +31,6 @@ typedef struct {
        void *user_data;
 } thumbUserData;
 
-typedef struct {
-       ThumbRawFunc func;
-       void *user_data;
-} thumbRawUserData;
-
 int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
 
 #endif /*_MEDIA_THUMB_INTERNAL_H_*/
index c196f7172ee2d3d56f27598ce16f69f75f967564..4975b3c8fcc4811b936000e920cb44bdc8d2cea6 100755 (executable)
@@ -34,7 +34,6 @@
 #define THUMB_IPC_PATH tzplatform_mkpath(TZ_SYS_RUN, "media-server/media_ipc_thumbcreator.socket")
 
 static GQueue *g_manage_queue = NULL;
-static GQueue *g_manage_raw_queue = NULL;
 
 
 typedef struct {
@@ -49,22 +48,7 @@ typedef struct {
        thumbUserData *userData;
 } thumbReq;
 
-typedef struct {
-       GIOChannel *channel;
-       int msg_type;
-       bool isCanceled;
-       bool isRequested;
-       int request_id;
-       int source_id;
-       unsigned int width;
-       unsigned int height;
-       uid_t uid;
-       char *path;
-       thumbRawUserData *userData;
-} thumbRawReq;
-
 static int __media_thumb_send_request(void);
-static int __media_thumb_raw_data_send_request(void);
 
 static int __media_thumb_cancel(unsigned int request_id)
 {
@@ -98,38 +82,6 @@ static int __media_thumb_cancel(unsigned int request_id)
        return MS_MEDIA_ERR_INTERNAL;
 }
 
-static int __media_thumb_cancel_raw_data(int request_id)
-{
-       int len = 0, i;
-       thumbRawReq *req = NULL;
-
-       thumb_retv_if(!g_manage_raw_queue, MS_MEDIA_ERR_NONE);
-
-       len = g_queue_get_length(g_manage_raw_queue);
-
-       for (i = 0; i < len; i++) {
-               req = (thumbRawReq *)g_queue_peek_nth(g_manage_raw_queue, i);
-               if (!req)
-                       continue;
-
-               if (req->request_id == request_id) {
-                       if (req->isRequested) {
-                               req->isCanceled = true;
-                       } else {
-                               g_queue_pop_nth(g_manage_raw_queue, i);
-
-                               SAFE_FREE(req->path);
-                               SAFE_FREE(req->userData);
-                               SAFE_FREE(req);
-                       }
-
-                       return MS_MEDIA_ERR_NONE;
-               }
-       }
-
-       return MS_MEDIA_ERR_INTERNAL;
-}
-
 static bool __media_thumb_is_canceled(void)
 {
        thumbReq *req = (thumbReq *)g_queue_peek_head(g_manage_queue);
@@ -140,102 +92,18 @@ static bool __media_thumb_is_canceled(void)
        return req->isCanceled;
 }
 
-static bool __media_thumb_is_canceled_for_raw(void)
+static int __media_thumb_recv_msg(int sock, thumbMsg *msg)
 {
-       thumbRawReq *req = (thumbRawReq *)g_queue_peek_head(g_manage_raw_queue);
-
-       if (!req)
-               return true;
-
-       return req->isCanceled;
-}
+       if (!msg)
+               return MS_MEDIA_ERR_INVALID_PARAMETER;
 
-static int __media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
-{
-       int remain_size = 0;
-       int recv_len = 0;
-       int recv_pos = 0;
-       unsigned char *buf = NULL;
-
-       THUMB_MALLOC(buf, header_size);
-       thumb_retv_if(!buf, MS_MEDIA_ERR_OUT_OF_MEMORY);
-
-       while (header_size > 0) {
-               if ((recv_len = recv(sock, buf + recv_pos, header_size, 0)) < 0) {
-                       thumb_stderror("recv failed");
-                       SAFE_FREE(buf);
-                       return MS_MEDIA_ERR_IPC;
-               }
-               header_size -= recv_len;
-               recv_pos += recv_len;
+       if (recv(sock, msg, sizeof(thumbMsg), 0) < 0) {
+               thumb_stderror("recv failed");
+               return MS_MEDIA_ERR_IPC;
        }
 
-       header_size = recv_pos;
-       recv_pos = 0;
-
-       memcpy(msg, buf, header_size);
-       SAFE_FREE(buf);
-
        thumb_retvm_if(strlen(msg->org_path) == 0 || strlen(msg->org_path) >= MAX_FILEPATH_LEN, MS_MEDIA_ERR_IPC, "Invalid org_path");
        thumb_retvm_if(strlen(msg->dst_path) >= MAX_FILEPATH_LEN, MS_MEDIA_ERR_IPC, "Invalid dst_path");
-       thumb_retvm_if(msg->thumb_size < 0, MS_MEDIA_ERR_IPC, "Invalid thumb_size");
-       thumb_retv_if(msg->thumb_size == 0, MS_MEDIA_ERR_NONE);
-
-       remain_size = msg->thumb_size;
-       THUMB_MALLOC(buf, remain_size);
-       thumb_retv_if(!buf, MS_MEDIA_ERR_OUT_OF_MEMORY);
-
-       while (remain_size > 0) {
-               if ((recv_len = recv(sock, buf + recv_pos, remain_size, 0)) < 0) {
-                       thumb_stderror("recv failed");
-                       SAFE_FREE(buf);
-                       return MS_MEDIA_ERR_IPC;
-               }
-
-               fsync(sock);
-               remain_size -= recv_len;
-               recv_pos += recv_len;
-       }
-
-       SAFE_FREE(msg->thumb_data);
-       THUMB_MALLOC(msg->thumb_data, msg->thumb_size);
-       if (msg->thumb_data) {
-               memcpy(msg->thumb_data, buf, msg->thumb_size);
-       } else {
-               SAFE_FREE(buf);
-               return MS_MEDIA_ERR_OUT_OF_MEMORY;
-       }
-
-       SAFE_FREE(buf);
-
-       return MS_MEDIA_ERR_NONE;
-}
-
-int _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size)
-{
-       if (req_msg == NULL || buf == NULL)
-               return MS_MEDIA_ERR_INVALID_PARAMETER;
-
-       int thumb_data_len = 0;
-       int size = 0;
-       int header_size = 0;
-
-       header_size = sizeof(thumbMsg) - sizeof(unsigned char *);
-       thumb_data_len = req_msg->thumb_size;
-       if (thumb_data_len < 0)
-               return MS_MEDIA_ERR_INVALID_PARAMETER;
-
-       size = header_size + thumb_data_len;
-       THUMB_MALLOC(*buf, size);
-       if (*buf == NULL) {
-               *buf_size = 0;
-               return 0;
-       }
-       memcpy(*buf, req_msg, header_size);
-       if (thumb_data_len > 0)
-               memcpy((*buf) + header_size, req_msg->thumb_data, thumb_data_len);
-
-       *buf_size = size;
 
        return MS_MEDIA_ERR_NONE;
 }
@@ -272,42 +140,9 @@ static void __media_thumb_pop(void)
                __media_thumb_send_request();
 }
 
-static void __media_thumb_pop_raw_data(void)
-{
-       int len = 0;
-       int sock = 0;
-       thumbRawReq *req = NULL;
-       GSource *source_id = NULL;
-
-       if (!g_manage_raw_queue)
-               return;
-
-       req = (thumbRawReq *)g_queue_pop_head(g_manage_raw_queue);
-       if (req) {
-               source_id = g_main_context_find_source_by_id(g_main_context_get_thread_default(), req->source_id);
-               sock = g_io_channel_unix_get_fd(req->channel);
-
-               g_io_channel_shutdown(req->channel, TRUE, NULL);
-               g_io_channel_unref(req->channel);
-               close(sock);
-               if (source_id)
-                       g_source_destroy(source_id);
-
-               SAFE_FREE(req->path);
-               SAFE_FREE(req->userData);
-               SAFE_FREE(req);
-       }
-
-       /* Check manage queue */
-       len = g_queue_get_length(g_manage_raw_queue);
-       if (len > 0)
-               __media_thumb_raw_data_send_request();
-}
-
 static gboolean __media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpointer data)
 {
        thumbMsg recv_msg;
-       int header_size = 0;
        int sock = 0;
        int err = MS_MEDIA_ERR_NONE;
        thumbUserData *userdata = NULL;
@@ -315,9 +150,7 @@ static gboolean __media_thumb_write_socket(GIOChannel *src, GIOCondition conditi
        memset((void *)&recv_msg, 0, sizeof(thumbMsg));
        sock = g_io_channel_unix_get_fd(src);
 
-       header_size = sizeof(thumbMsg) - sizeof(unsigned char *);
-
-       if ((err = __media_thumb_recv_msg(sock, header_size, &recv_msg)) < 0) {
+       if ((err = __media_thumb_recv_msg(sock, &recv_msg)) < 0) {
                thumb_err("_media_thumb_recv_msg failed ");
                goto NEXT;
        }
@@ -341,45 +174,6 @@ NEXT:
        return G_SOURCE_REMOVE;
 }
 
-static gboolean __media_thumb_raw_data_write_socket(GIOChannel *src, GIOCondition condition, gpointer data)
-{
-       thumbMsg recv_msg;
-       int header_size = 0;
-       int sock = 0;
-       int err = MS_MEDIA_ERR_NONE;
-       thumbRawUserData *userdata = NULL;
-
-       memset((void *)&recv_msg, 0, sizeof(thumbMsg));
-       sock = g_io_channel_unix_get_fd(src);
-
-       header_size = sizeof(thumbMsg) - sizeof(unsigned char *);
-
-       thumb_err("_media_thumb_write_socket socket : %d", sock);
-
-       if ((err = __media_thumb_recv_msg(sock, header_size, &recv_msg)) < 0) {
-               thumb_err("_media_thumb_recv_msg failed ");
-               goto NEXT;
-       }
-
-       if (recv_msg.status != MS_MEDIA_ERR_NONE) {
-               err = recv_msg.status;
-               thumb_err("Failed to make thumbnail (%d)", err);
-       }
-
-       if (__media_thumb_is_canceled_for_raw() || !data)
-               goto NEXT;
-
-       userdata = (thumbRawUserData*)data;
-       if (userdata->func)
-               userdata->func(err, recv_msg.request_id, recv_msg.org_path, recv_msg.thumb_width, recv_msg.thumb_height, recv_msg.thumb_data, recv_msg.thumb_size, userdata->user_data);
-
-       thumb_dbg("Done");
-NEXT:
-       __media_thumb_pop_raw_data();
-
-       return G_SOURCE_REMOVE;
-}
-
 static int __media_thumb_send_request(void)
 {
        int err = MS_MEDIA_ERR_NONE;
@@ -438,15 +232,9 @@ static int __media_thumb_send_request(void)
        req_msg.uid = req_manager->uid;
        SAFE_STRLCPY(req_msg.org_path, req_manager->path, sizeof(req_msg.org_path));
        req_msg.dst_path[0] = '\0';
-       req_msg.thumb_size = 0;
-
-       unsigned char *buf = NULL;
-       int buf_size = 0;
-       _media_thumb_set_buffer(&req_msg, &buf, &buf_size);
 
-       if (send(sock, buf, buf_size, 0) < 0) {
+       if (send(sock, &req_msg, sizeof(req_msg), 0) < 0) {
                thumb_err("send failed: %d", errno);
-               SAFE_FREE(buf);
                g_source_destroy(g_main_context_find_source_by_id(g_main_context_get_thread_default(), source_id));
                g_io_channel_shutdown(channel, TRUE, NULL);
                g_io_channel_unref(channel);
@@ -454,7 +242,6 @@ static int __media_thumb_send_request(void)
                return MS_MEDIA_ERR_IPC;
        }
 
-       SAFE_FREE(buf);
        thumb_dbg("Sending msg to thumbnail daemon is successful");
 
        if (req_manager->msg_type == THUMB_REQUEST_DB_INSERT) {
@@ -466,92 +253,6 @@ static int __media_thumb_send_request(void)
        return err;
 }
 
-static int __media_thumb_raw_data_send_request(void)
-{
-       int err = MS_MEDIA_ERR_NONE;
-       int sock = -1;
-       struct sockaddr_un serv_addr;
-       thumbRawReq *req_manager = NULL;
-       int pid;
-
-       err = ms_ipc_create_client_socket(MS_TIMEOUT_SEC_10, &sock);
-       thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "ms_ipc_create_client_socket failed");
-
-       memset(&serv_addr, 0, sizeof(serv_addr));
-       serv_addr.sun_family = AF_UNIX;
-       SAFE_STRLCPY(serv_addr.sun_path, THUMB_IPC_PATH, sizeof(serv_addr.sun_path));
-
-       GIOChannel *channel = NULL;
-       channel = g_io_channel_unix_new(sock);
-       int source_id = -1;
-
-       /* Connecting to the thumbnail server */
-       if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
-               thumb_stderror("connect error");
-               if (errno == EACCES)
-                       err = MS_MEDIA_ERR_PERMISSION_DENIED;
-               else
-                       err = MS_MEDIA_ERR_IPC;
-
-               g_io_channel_shutdown(channel, TRUE, NULL);
-               g_io_channel_unref(channel);
-               close(sock);
-               return err;
-       }
-
-       req_manager = (thumbRawReq *)g_queue_peek_head(g_manage_raw_queue);
-
-       if (!req_manager) {
-               thumb_err("queue peek fail");
-               g_io_channel_shutdown(channel, TRUE, NULL);
-               g_io_channel_unref(channel);
-               close(sock);
-               return MS_MEDIA_ERR_INVALID_PARAMETER;
-       }
-
-       GSource *source = NULL;
-       source = g_io_create_watch(channel, G_IO_IN);
-       g_source_set_callback(source, (GSourceFunc)__media_thumb_raw_data_write_socket, req_manager->userData, NULL);
-       source_id = g_source_attach(source, g_main_context_get_thread_default());
-
-       thumbMsg req_msg;
-       memset((void *)&req_msg, 0, sizeof(thumbMsg));
-
-       pid = getpid();
-       req_msg.pid = pid;
-       req_msg.msg_type = req_manager->msg_type;
-       req_msg.request_id = req_manager->request_id;
-       req_msg.thumb_width = req_manager->width;
-       req_msg.thumb_height = req_manager->height;
-       req_msg.uid = req_manager->uid;
-
-       SAFE_STRLCPY(req_msg.org_path, req_manager->path, sizeof(req_msg.org_path));
-       req_msg.dst_path[0] = '\0';
-       req_msg.thumb_size = 0;
-
-       unsigned char *buf = NULL;
-       int buf_size = 0;
-       _media_thumb_set_buffer(&req_msg, &buf, &buf_size);
-
-       if (send(sock, buf, buf_size, 0) < 0) {
-               thumb_err("send failed: %d", errno);
-               SAFE_FREE(buf);
-               g_source_destroy(g_main_context_find_source_by_id(g_main_context_get_thread_default(), source_id));
-               g_io_channel_shutdown(channel, TRUE, NULL);
-               g_io_channel_unref(channel);
-               return MS_MEDIA_ERR_IPC;
-       }
-
-       SAFE_FREE(buf);
-
-       if (req_manager->msg_type == THUMB_REQUEST_RAW_DATA) {
-               req_manager->channel = channel;
-               req_manager->source_id = source_id;
-               req_manager->isRequested = true;
-       }
-       return MS_MEDIA_ERR_NONE;
-}
-
 int _media_thumb_request_async(int msg_type, unsigned int request_id, const char *origin_path, thumbUserData *userData, uid_t uid)
 {
        int err = MS_MEDIA_ERR_NONE;
@@ -582,41 +283,4 @@ int _media_thumb_request_async(int msg_type, unsigned int request_id, const char
                err = __media_thumb_send_request();
 
        return err;
-}
-
-int _media_thumb_request_raw_data_async(int msg_type, int request_id, const char *origin_path, int width, int height, thumbRawUserData *userData, uid_t uid)
-{
-       int err = MS_MEDIA_ERR_NONE;
-       int len = 0;
-       thumbRawReq *thumb_req = NULL;
-
-       if (msg_type == THUMB_REQUEST_CANCEL_RAW_DATA)
-               return __media_thumb_cancel_raw_data(request_id);
-
-       if (g_manage_raw_queue == NULL)
-               g_manage_raw_queue = g_queue_new();
-
-       THUMB_MALLOC(thumb_req, sizeof(thumbRawReq));
-       if (thumb_req == NULL) {
-               thumb_err("Failed to create request element");
-               return MS_MEDIA_ERR_INVALID_PARAMETER;
-       }
-
-       thumb_req->msg_type = msg_type;
-       thumb_req->request_id = request_id;
-       thumb_req->path = g_strdup(origin_path);
-       thumb_req->width = width;
-       thumb_req->height = height;
-       thumb_req->userData = userData;
-       thumb_req->isCanceled = false;
-       thumb_req->isRequested = false;
-       thumb_req->uid = uid;
-
-       len = g_queue_get_length(g_manage_raw_queue);
-       g_queue_push_tail(g_manage_raw_queue, (gpointer)thumb_req);
-
-       if (len == 0)
-               err = __media_thumb_raw_data_send_request();
-
-       return err;
-}
+}
\ No newline at end of file
index d719f7f416502dc1f260caf2f2395ebe9ccc2dcc..4425764b61a43c514bfc6e3cd2e6e8e58affb7f2 100755 (executable)
@@ -66,44 +66,6 @@ int thumbnail_request_from_db_async(unsigned int request_id, const char *origin_
        return MS_MEDIA_ERR_NONE;
 }
 
-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 err = MS_MEDIA_ERR_NONE;
-       int exist = 0;
-
-       thumb_retvm_if(!origin_path || request_id == 0, MS_MEDIA_ERR_INVALID_PARAMETER, "original path is NULL. Or there is an error in request_id.");
-
-       /* check the file exits actually */
-       exist = open(origin_path, O_RDONLY);
-       if (exist < 0) {
-               if (errno == EACCES || errno == EPERM) {
-                       thumb_err("Fail to open original_path[%s]: Permission Denied", origin_path);
-                       return  MS_MEDIA_ERR_PERMISSION_DENIED;
-               } else {
-                       thumb_err("Fail to open original_path[%s]: Invalid Path", origin_path);
-                       return MS_MEDIA_ERR_INVALID_PARAMETER;
-               }
-       }
-       close(exist);
-
-       thumb_dbg_slog("Path : %s", origin_path);
-
-       thumbRawUserData *userData = (thumbRawUserData*)malloc(sizeof(thumbRawUserData));
-       thumb_retvm_if(!userData, MS_MEDIA_ERR_OUT_OF_MEMORY, "Allocation failed");
-
-       userData->func = func;
-       userData->user_data = user_data;
-
-       err = _media_thumb_request_raw_data_async(THUMB_REQUEST_RAW_DATA, request_id, origin_path, width, height, userData, uid);
-       if (err != MS_MEDIA_ERR_NONE) {
-               thumb_err("_media_raw_thumb_request failed : %d", err);
-               SAFE_FREE(userData);
-               return err;
-       }
-
-       return MS_MEDIA_ERR_NONE;
-}
-
 int thumbnail_request_cancel_media(unsigned int request_id)
 {
        int err = MS_MEDIA_ERR_NONE;
@@ -114,18 +76,6 @@ int thumbnail_request_cancel_media(unsigned int request_id)
        return err;
 }
 
-int thumbnail_request_cancel_raw_data(int request_id)
-{
-       int err = MS_MEDIA_ERR_NONE;
-
-       thumb_retvm_if(request_id == 0, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid parameter");
-
-       err = _media_thumb_request_raw_data_async(THUMB_REQUEST_CANCEL_RAW_DATA, request_id, NULL, 0, 0, NULL, 0);
-       thumb_retvm_if(err != MS_MEDIA_ERR_NONE, err, "_media_thumb_request_raw_data_async failed : %d", err);
-
-       return err;
-}
-
 static void __get_rotation_and_cdis(const char *path, mm_util_rotate_type_e *rot_type, int *cdis_value)
 {
        int err = MS_MEDIA_ERR_NONE;