summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMinje Ahn <minje.ahn@samsung.com>2018-02-02 05:59:16 (GMT)
committerMinje Ahn <minje.ahn@samsung.com>2018-02-02 05:59:16 (GMT)
commit2ad4d2c4e74fd8238fa6e43cd6f0243a055f0c5f (patch)
tree7d02c9bba65a815f2c3c5ca78b3fa4fe52449a09 /src
parent70e71ce6be7153129a543240b4c30aaee368c7b9 (diff)
downloadlibmedia-thumbnail-2ad4d2c4e74fd8238fa6e43cd6f0243a055f0c5f.zip
libmedia-thumbnail-2ad4d2c4e74fd8238fa6e43cd6f0243a055f0c5f.tar.gz
libmedia-thumbnail-2ad4d2c4e74fd8238fa6e43cd6f0243a055f0c5f.tar.bz2
Remove sync requestrefs/changes/70/169070/1
Change-Id: Ic9efd546cc06b7f6bfc9d493ec9e91ae2b4f8e07 Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/ipc/media-thumb-ipc.h1
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c94
-rwxr-xr-xsrc/media-thumb-internal.c1
-rwxr-xr-xsrc/media-thumbnail.c39
4 files changed, 1 insertions, 134 deletions
diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h
index 71deb3e..9f0d6f7 100755
--- a/src/include/ipc/media-thumb-ipc.h
+++ b/src/include/ipc/media-thumb-ipc.h
@@ -41,7 +41,6 @@
int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg);
int _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, uid_t uid);
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,
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 3e8ccec..6a06281 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -359,100 +359,6 @@ int _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_siz
return MS_MEDIA_ERR_NONE;
}
-int _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;
- int recv_str_len = 0;
- int err = MS_MEDIA_ERR_NONE;
- int pid;
-
- err = ms_ipc_create_client_socket(MS_TIMEOUT_SEC_10, &sock);
- if (err != MS_MEDIA_ERR_NONE) {
- thumb_err("ms_ipc_create_client_socket failed");
- return err;
- }
-
- 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));
-
- /* Connecting to the thumbnail server */
- if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
- thumb_stderror("connect");
- close(sock);
- return MS_MEDIA_ERR_SOCKET_CONN;
- }
-
- thumbMsg req_msg;
- thumbMsg recv_msg;
-
- memset((void *)&req_msg, 0, sizeof(thumbMsg));
- memset((void *)&recv_msg, 0, sizeof(thumbMsg));
-
- /* Get PID of client*/
- pid = getpid();
- req_msg.pid = pid;
-
- /* Set requset message */
- req_msg.msg_type = msg_type;
- req_msg.uid = uid;
- SAFE_STRLCPY(req_msg.org_path, origin_path, sizeof(req_msg.org_path));
- req_msg.origin_path_size = strlen(req_msg.org_path) + 1;
- req_msg.dest_path_size = strlen(req_msg.dst_path) + 1;
- req_msg.thumb_size = 0;
-
- if (req_msg.origin_path_size > MAX_PATH_SIZE || req_msg.dest_path_size > MAX_PATH_SIZE) {
- thumb_err("path's length exceeds %d", MAX_PATH_SIZE);
- close(sock);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- unsigned char *buf = NULL;
- int buf_size = 0;
- int header_size = 0;
-
- header_size = sizeof(thumbMsg) - MAX_PATH_SIZE*2 - sizeof(unsigned char *);
- _media_thumb_set_buffer(&req_msg, &buf, &buf_size);
-
- if (send(sock, buf, buf_size, 0) != buf_size) {
- thumb_err("sendto failed: %d", errno);
- SAFE_FREE(buf);
- close(sock);
- return MS_MEDIA_ERR_SOCKET_SEND;
- }
-
- thumb_dbg("Sending msg to thumbnail daemon is successful");
-
- SAFE_FREE(buf);
-
- if ((err = _media_thumb_recv_msg(sock, header_size, &recv_msg)) < 0) {
- thumb_err("_media_thumb_recv_msg failed ");
- close(sock);
- return err;
- }
-
- recv_str_len = strlen(recv_msg.org_path);
- 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);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (recv_msg.status != MS_MEDIA_ERR_NONE) {
- thumb_err("Failed to make thumbnail");
- return recv_msg.status;
- }
-
- SAFE_STRLCPY(thumb_path, recv_msg.dst_path, max_length);
-
- return MS_MEDIA_ERR_NONE;
-}
-
gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpointer data)
{
thumbMsg recv_msg;
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 9ada79e..0238d15 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -244,6 +244,7 @@ int _media_thumb_video(const char *origin_path, const char *thumb_path, int thum
thumb_err("Failed to get thumb size");
goto ERROR;
}
+
thumb_dbg("Origin:W[%d] H[%d] Proper:W[%d] H[%d]", width, height, thumb_width, thumb_height);
err = mm_util_create_handle(&img, (unsigned char *)frame, width, height, size, MM_UTIL_IMG_FMT_RGB888);
diff --git a/src/media-thumbnail.c b/src/media-thumbnail.c
index 554988b..690a4d1 100755
--- a/src/media-thumbnail.c
+++ b/src/media-thumbnail.c
@@ -27,45 +27,6 @@
#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;
-
- 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_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;
- }
-
- ms_user_storage_type_e store_type = -1;
- err = ms_user_get_storage_type(uid, origin_path, &store_type);
-
- if ((err != MS_MEDIA_ERR_NONE) || ((store_type != MS_USER_STORAGE_INTERNAL) && (store_type != MS_USER_STORAGE_EXTERNAL))) {
- thumb_err_slog("origin path(%s) is invalid. err : [%d] store_type [%d]", origin_path, err, store_type);
- 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, origin_path, thumb_path, max_length, 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_async(unsigned int request_id, const char *origin_path, ThumbFunc func, void *user_data, uid_t uid)
{
int err = MS_MEDIA_ERR_NONE;