Source1003: media-thumbnail-server.manifest
Requires: media-server
-BuildRequires: cmake
-BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(drm-client)
-BuildRequires: pkgconfig(heynoti)
-BuildRequires: pkgconfig(libexif)
-BuildRequires: pkgconfig(libmedia-utils)
-BuildRequires: pkgconfig(mm-fileinfo)
-BuildRequires: pkgconfig(mmutil-imgp)
-BuildRequires: pkgconfig(mmutil-jpeg)
-BuildRequires: pkgconfig(vconf)
-BuildRequires: pkgconfig(libtzplatform-config)
-BuildRequires: pkgconfig(gdk-pixbuf-2.0)
+BuildRequires: cmake
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(mm-fileinfo)
+BuildRequires: pkgconfig(mmutil-imgp)
+BuildRequires: pkgconfig(mmutil-jpeg)
+BuildRequires: pkgconfig(drm-client)
+BuildRequires: pkgconfig(heynoti)
+BuildRequires: pkgconfig(libexif)
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(libmedia-utils)
+BuildRequires: pkgconfig(libtzplatform-config)
+BuildRequires: pkgconfig(gdk-pixbuf-2.0)
%description
-Media thumbnail service library for multimedia applications.
+Description: Media thumbnail service library for multimedia applications.
%package devel
Summary: Media Thumbnail Service Library (development)
Requires: %{name} = %{version}-%{release}
%description -n media-thumbnail-server
-Media Thumbnail Server.
+Description: Media Thumbnail Server.
%package test
Summary: Thumbnail generator Tests
}
g_main_loop_quit(g_thumb_server_mainloop);
-
+
return;
}
_media_thumb_set_buffer(&res_msg, &buf, &buf_size);
if (sendto(sock, buf, buf_size, 0, (struct sockaddr *)&client_addr, sizeof(client_addr)) != buf_size) {
- thumb_err("sendto failed: %s\n", strerror(errno));
+ thumb_stderror("sendto failed");
SAFE_FREE(buf);
return FALSE;
}
if (!_is_real_drm) {
ret = fseek(hFile, offset, position);
if (ret < 0) {
- thumb_err("fseek failed : %s", strerror(errno));
+ thumb_stderror("fseek failed");
return FALSE;
}
} else {
#define FONT_COLOR_CYAN "\033[36m"
#define FONT_COLOR_GRAY "\033[37m"
-#define thumb_dbg(fmt, arg...) LOGD(FONT_COLOR_RESET"[%d] " fmt "\n", gettid(), ##arg)
-#define thumb_warn(fmt, arg...) LOGW(FONT_COLOR_GREEN"[%d] " fmt "\n", gettid(), ##arg)
-#define thumb_err(fmt, arg...) LOGE(FONT_COLOR_RED"[%d] " fmt "\n", gettid(), ##arg)
+#define thumb_dbg(fmt, arg...) do{ \
+ LOGD(FONT_COLOR_RESET"[%d] " fmt "\n", gettid(), ##arg); \
+ } while(0)
+
+#define thumb_warn(fmt, arg...) do{ \
+ LOGW(FONT_COLOR_GREEN"[%d] " fmt "\n", gettid(), ##arg); \
+ } while(0)
+
+#define thumb_err(fmt, arg...) do{ \
+ LOGE(FONT_COLOR_RED"[%d] " fmt "\n", gettid(), ##arg); \
+ } while(0)
+
+#define thumb_dbg_slog(fmt, arg...) do{ \
+ SECURE_LOGD(FONT_COLOR_RESET"[%d] " fmt "\n", gettid(), ##arg); \
+ } while(0)
+
+#define thumb_warn_slog(fmt, arg...) do{ \
+ SECURE_LOGW(FONT_COLOR_GREEN"[%d] " fmt "\n", gettid(), ##arg); \
+ } while(0)
+
+
+#define ERR_BUF_LENGHT 256
+#define thumb_stderror(fmt) do { \
+ char buf[ERR_BUF_LENGHT] = {0,}; \
+ strerror_r(errno, buf, ERR_BUF_LENGHT); \
+ LOGE(FONT_COLOR_RED fmt" : standard error [%s]", buf); \
+ } while (0)
#ifdef _USE_LOG_FILE_
void thumb_init_file_debug();
buf = (unsigned char*)malloc(header_size);
if ((recv_msg_len = recv(sock, buf, header_size, 0)) <= 0) {
- thumb_err("recvfrom failed : %s", strerror(errno));
+ thumb_stderror("recv failed");
SAFE_FREE(buf);
return _media_thumb_get_error();
}
buf = (unsigned char*)malloc(sizeof(thumbMsg));
if ((recv_msg_len = recvfrom(sock, buf, sizeof(thumbMsg), 0, (struct sockaddr *)from_addr, &from_addr_size)) < 0) {
- thumb_err("recvfrom failed : %s", strerror(errno));
+ thumb_stderror("recvform failed");
SAFE_FREE(buf);
return _media_thumb_get_error();
}
/* Connecting to the thumbnail server */
if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
- thumb_err("connect error : %s", strerror(errno));
+ thumb_stderror("connect");
return MS_MEDIA_ERR_SOCKET_CONN;
}
_media_thumb_set_buffer(&req_msg, &buf, &buf_size);
if (send(sock, buf, buf_size, 0) != buf_size) {
- thumb_err("sendto failed: %d\n", errno);
+ thumb_err("sendto failed: %d", errno);
SAFE_FREE(buf);
close(sock);
return MS_MEDIA_ERR_SOCKET_SEND;
}
recv_str_len = strlen(recv_msg.org_path);
- thumb_dbg("recv %s(%d) from thumb daemon is successful", recv_msg.org_path, recv_str_len);
+ thumb_dbg_slog("recv %s(%d) from thumb daemon is successful", recv_msg.org_path, recv_str_len);
close(sock);
req_msg.pid = pid;
req_msg.msg_type = msg_type;
req_msg.thumb_type = thumb_type;
- req_msg.uid = uid;
+ req_msg.uid = uid;
strncpy(req_msg.org_path, origin_path, sizeof(req_msg.org_path));
req_msg.org_path[strlen(req_msg.org_path)] = '\0';
_media_thumb_set_buffer(&req_msg, &buf, &buf_size);
if (send(sock, buf, buf_size, 0) != buf_size) {
- thumb_err("sendto failed: %d\n", errno);
+ thumb_err("sendto 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);
tag == EXIF_TAG_PIXEL_Y_DIMENSION) {
if (value == NULL) {
- thumb_dbg("value is NULL");
+ thumb_err("value is NULL");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
} else {
/* Get the contents of the tag in human-readable form */
if (buf == NULL) {
- thumb_dbg("buf is NULL");
+ thumb_err("buf is NULL");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
exif_entry_get_value(entry, buf, max_size);
return MS_MEDIA_ERR_NONE;
}
-int _media_thumb_get_thumb_from_exif(ExifData *ed,
- const char *file_full_path,
+int _media_thumb_get_thumb_from_exif(ExifData *ed,
+ const char *file_full_path,
int orientation,
int required_width,
int required_height,
if (entry) {
/* Get the contents of the tag in human-readable form */
ExifShort value = exif_get_short(entry->data, byte_order);
- //thumb_dbg("%s: %d\n", exif_tag_get_name_in_ifd(tag,ifd), value);
+ //thumb_dbg("%s: %d", exif_tag_get_name_in_ifd(tag,ifd), value);
if (value == 6) {
thumb_dbg("There's jpeg thumb in this image");
g_object_unref(pixbuf);
} else {
- thumb_dbg("no contents information\n");
+ thumb_dbg("no contents information");
frame = NULL;
mm_file_destroy_content_attrs(content);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- thumb_err("Path : %s", origin_path);
+ thumb_dbg_slog("Path : %s", origin_path);
/* Request for thumb file to the daemon "Thumbnail generator" */
err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- thumb_err("Path : %s", origin_path);
+ thumb_dbg_slog("Path : %s", origin_path);
/* Request for thumb file to the daemon "Thumbnail generator" */
err = _media_thumb_request(THUMB_REQUEST_DB_INSERT, MEDIA_THUMB_LARGE, origin_path, thumb_path, max_length, &thumb_info, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("_media_thumb_request failed : %d", err);
- //_media_thumb_db_disconnect();
return err;
}
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- thumb_err("Path : %s", origin_path);
+ thumb_dbg_slog("Path : %s", origin_path);
thumbUserData *userData = (thumbUserData*)malloc(sizeof(thumbUserData));
userData->func = (ThumbFunc)func;
int _media_thumbnail_cancel_cb(int error_code, char* path, void* data)
{
thumb_dbg("Error code : %d", error_code);
- if (path) thumb_dbg("Cancel : %s", path);
+ if (path) thumb_dbg_slog("Cancel : %s", path);
return MS_MEDIA_ERR_NONE;
}
const char *origin_path,
int *type)
{
- thumb_dbg("Origin path : %s", origin_path);
+ thumb_dbg_slog("Origin path : %s", origin_path);
if (handle == NULL) {
thumb_err("DB handle is NULL");
int *width,
int *height)
{
- thumb_dbg("Origin path : %s", origin_path);
+ thumb_dbg_slog("Origin path : %s", origin_path);
if (handle == NULL) {
thumb_err("DB handle is NULL");
path_string = sqlite3_mprintf("%s", origin_path);
query_string = sqlite3_mprintf(SELECT_WH_BY_PATH, path_string);
- thumb_dbg("Query: %s", query_string);
+ thumb_dbg_slog("Query: %s", query_string);
err = sqlite3_prepare_v2(handle, query_string, strlen(query_string), &stmt, NULL);
sqlite3_free(path_string);
if (SQLITE_OK != err) {
- thumb_err("prepare error [%s]\n", sqlite3_errmsg(handle));
+ thumb_err("prepare error [%s]", sqlite3_errmsg(handle));
return -1;
}
err = sqlite3_step(stmt);
if (err != SQLITE_ROW) {
- thumb_err("end of row [%s]\n", sqlite3_errmsg(handle));
+ thumb_err("end of row [%s]", sqlite3_errmsg(handle));
sqlite3_finalize(stmt);
return -1;
}
char *thumb_path,
int max_length)
{
- thumb_dbg("Origin path : %s", origin_path);
+ thumb_dbg_slog("Origin path : %s", origin_path);
if (handle == NULL) {
thumb_err("DB handle is NULL");
path_string = sqlite3_mprintf("%s", origin_path);
query_string = sqlite3_mprintf(SELECT_MEDIA_BY_PATH, path_string);
- thumb_dbg("Query: %s", query_string);
+ thumb_dbg_slog("Query: %s", query_string);
err = sqlite3_prepare_v2(handle, query_string, strlen(query_string), &stmt, NULL);
char *thumb_path,
uid_t uid)
{
- thumb_dbg("");
int err = MS_MEDIA_ERR_NONE;
char *path_string = NULL;
char *thumbpath_string = NULL;
query_string = sqlite3_mprintf(UPDATE_THUMB_BY_PATH, thumbpath_string, path_string);
err = media_db_request_update_db(query_string, uid);
- if (err < 0) {
+ if (err != MS_MEDIA_ERR_NONE) {
thumb_err("media_db_request_update_db failed : %d", err);
- return err;
+ } else {
+ thumb_dbg("Query success");
}
- thumb_dbg("Query success");
- return MS_MEDIA_ERR_NONE;
+ return err;
}
int _media_thumb_update_wh_to_db(sqlite3 *handle,
err = media_db_request_update_db(query_string, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("media_db_request_update_db failed : %d", err);
- return err;
+ } else {
+ thumb_dbg("Query success");
}
- thumb_dbg("Query success");
return err;
}
err = media_db_request_update_db(query_string, uid);
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("media_db_request_update_db failed : %d", err);
- return err;
+ } else {
+ thumb_dbg("Query success");
}
- thumb_dbg("Query success");
-
return err;
}
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("media_db_connect failed: %d", err);
db_handle = NULL;
- return MS_MEDIA_ERR_DB_CONNECT_FAIL;
+ return err;
}
return MS_MEDIA_ERR_NONE;
if (err != MS_MEDIA_ERR_NONE) {
thumb_err("media_db_disconnect failed: %d", err);
db_handle = NULL;
- return MS_MEDIA_ERR_DB_CONNECT_FAIL;
+ return err;
}
db_handle = NULL;
return -1;
}
- thumb_dbg("Thumb path in DB is %s", thumb_path);
+ thumb_dbg_slog("Thumb path in DB is %s", thumb_path);
if (!g_file_test(thumb_path,
G_FILE_TEST_EXISTS)) {
return -1;
}
- thumb_dbg("Thumb path in DB is %s", thumb_path);
+ thumb_dbg_slog("Thumb path in DB is %s", thumb_path);
if (!g_file_test(thumb_path,
G_FILE_TEST_EXISTS)) {
(double)(time.tv_sec * 1000000 + time.tv_usec -
g_time_usec) / CLOCKS_PER_SEC;
- thumb_dbg("time [%s] : %f \n", time_string, totaltime);
+ thumb_dbg("time [%s] : %f", time_string, totaltime);
#endif
}
totaltime = (double)(end - start) / CLOCKS_PER_SEC;
- thumb_dbg("time [%s: %s] : %f \n", func_name, time_string,
+ thumb_dbg("time [%s: %s] : %f", func_name, time_string,
totaltime);
#endif
}
#include "media-thumb-util.h"
#include "media-thumb-internal.h"
+#include "media-thumb-debug.h"
#include <glib.h>
#include <aul.h>
thumb_dbg("success to remove file");
return TRUE;
} else {
- thumb_err("fail to remove file[%s] result errno = %s", path, strerror(errno));
+ thumb_stderror("fail to remove file[%s] result");
return FALSE;
}
}