summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/ipc/media-thumb-ipc.h17
-rwxr-xr-xsrc/include/media-thumb-internal.h6
-rwxr-xr-xsrc/include/util/media-thumb-util.h2
-rwxr-xr-xsrc/ipc/media-thumb-ipc.c62
-rwxr-xr-xsrc/util/media-thumb-util.c3
5 files changed, 9 insertions, 81 deletions
diff --git a/src/include/ipc/media-thumb-ipc.h b/src/include/ipc/media-thumb-ipc.h
index cc021b6..651cd7c 100755
--- a/src/include/ipc/media-thumb-ipc.h
+++ b/src/include/ipc/media-thumb-ipc.h
@@ -38,25 +38,12 @@
#define _MEDIA_THUMB_IPC_H_
#define MAX_PATH_SIZE 4096
-#define MAX_TRIES 3
int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg);
-
-int _media_thumb_recv_udp_msg(int sock, int header_size, thumbMsg *msg, struct sockaddr_un *from_addr, unsigned int *from_size);
-
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(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,
int request_id,
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h
index 358fdc2..43d9b41 100755
--- a/src/include/media-thumb-internal.h
+++ b/src/include/media-thumb-internal.h
@@ -27,15 +27,9 @@
#ifndef _MEDIA_THUMB_INTERNAL_H_
#define _MEDIA_THUMB_INTERNAL_H_
-#define THUMB_WIDTH_MAX
/* The maximum of resolution to be able to get thumbnail is 3000 x 3000, except for only jpeg */
#define THUMB_MAX_ALLOWED_MEM_FOR_THUMB 9000000
-#define THUMB_LARGE_WIDTH 320
-#define THUMB_LARGE_HEIGHT 240
-#define THUMB_SMALL_WIDTH 160
-#define THUMB_SMALL_HEIGHT 120
-
typedef struct {
int size;
int width;
diff --git a/src/include/util/media-thumb-util.h b/src/include/util/media-thumb-util.h
index 4b9c74b..c71d6a3 100755
--- a/src/include/util/media-thumb-util.h
+++ b/src/include/util/media-thumb-util.h
@@ -34,11 +34,9 @@
#define THUMB_VIDEO_TYPE 1 /* Video */
int _media_thumb_get_file_ext(const char *file_path, char *file_ext, int max_len);
-
int _media_thumb_get_file_type(const char *file_full_path);
char* _media_thumb_generate_hash_name(const char *file);
-
int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
int _media_thumb_remove_file(const char *path);
diff --git a/src/ipc/media-thumb-ipc.c b/src/ipc/media-thumb-ipc.c
index 9064a7b..6b63959 100755
--- a/src/ipc/media-thumb-ipc.c
+++ b/src/ipc/media-thumb-ipc.c
@@ -117,7 +117,7 @@ void __media_thumb_shutdown_channel(bool only_shutdown)
}
}
-int __media_thumb_pop_req_queue(const char *path)
+int __media_thumb_pop_req_queue()
{
int req_len = 0;
@@ -380,8 +380,7 @@ bool __media_thumb_check_cancel_for_raw(void)
}
}
-int
-_media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
+int _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
{
int recv_msg_len = 0;
int remain_size = 0;
@@ -460,51 +459,7 @@ _media_thumb_recv_msg(int sock, int header_size, thumbMsg *msg)
return MS_MEDIA_ERR_NONE;
}
-int
-_media_thumb_recv_udp_msg(int sock, int header_size, thumbMsg *msg, struct sockaddr_un *from_addr, unsigned int *from_size)
-{
- int recv_msg_len = 0;
- unsigned int from_addr_size = sizeof(struct sockaddr_un);
- unsigned char *buf = NULL;
-
- THUMB_MALLOC(buf, sizeof(thumbMsg));
- if (buf == NULL) {
- thumb_err("memory allocation failed");
- return MS_MEDIA_ERR_OUT_OF_MEMORY;
- }
-
- if ((recv_msg_len = recvfrom(sock, buf, sizeof(thumbMsg), 0, (struct sockaddr *)from_addr, &from_addr_size)) < 0) {
- thumb_stderror("recvform failed");
- SAFE_FREE(buf);
- return _media_thumb_get_error();
- }
-
- memcpy(msg, buf, header_size);
-
- if (msg->origin_path_size <= 0 || msg->origin_path_size > MAX_PATH_SIZE) {
- SAFE_FREE(buf);
- thumb_err("msg->origin_path_size is invalid %d", msg->origin_path_size);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- SAFE_STRLCPY(msg->org_path, (char*)buf + header_size, sizeof(msg->org_path));
-
- if (msg->dest_path_size <= 0 || msg->dest_path_size > MAX_PATH_SIZE) {
- SAFE_FREE(buf);
- thumb_err("msg->origin_path_size is invalid %d", msg->dest_path_size);
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- SAFE_STRLCPY(msg->dst_path, (char*)buf + header_size + msg->origin_path_size, sizeof(msg->dst_path));
-
- SAFE_FREE(buf);
- *from_size = from_addr_size;
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int
-_media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size)
+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;
@@ -540,8 +495,7 @@ _media_thumb_set_buffer(thumbMsg *req_msg, unsigned char **buf, int *buf_size)
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 _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;
@@ -653,11 +607,7 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi
if ((err = _media_thumb_recv_msg(sock, header_size, &recv_msg)) < 0) {
thumb_err("_media_thumb_recv_msg failed ");
- if (recv_msg.origin_path_size > 0) {
- __media_thumb_pop_req_queue(recv_msg.org_path);
- } else {
- thumb_err("origin path size is wrong.");
- }
+ __media_thumb_pop_req_queue();
return FALSE;
}
@@ -675,7 +625,7 @@ gboolean _media_thumb_write_socket(GIOChannel *src, GIOCondition condition, gpoi
}
}
- __media_thumb_pop_req_queue(recv_msg.org_path);
+ __media_thumb_pop_req_queue();
thumb_dbg("Done");
diff --git a/src/util/media-thumb-util.c b/src/util/media-thumb-util.c
index 5c4afb7..b9140cb 100755
--- a/src/util/media-thumb-util.c
+++ b/src/util/media-thumb-util.c
@@ -27,8 +27,7 @@
#include <aul.h>
#include <string.h>
-int
-_media_thumb_get_file_type(const char *file_full_path)
+int _media_thumb_get_file_type(const char *file_full_path)
{
int ret = 0;
char mimetype[255] = {0,};