ac9a8ab98aa11bfd436923aa6470356fe721fa67
[platform/core/multimedia/libmedia-thumbnail.git] / server / include / thumb-server-internal.h
1 /*
2  * media-thumbnail-server
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <glib.h>
23 #include <vconf.h>
24 #include "media-thumb-ipc.h"
25 #include "media-thumb-db.h"
26
27 #ifndef _THUMB_DAEMON_INTERNAL_H_
28 #define _THUMB_DAEMON_INTERNAL_H_
29
30 #define SAFE_FREE(src)      { if(src) {free(src); src = NULL;}}
31
32 typedef enum {
33         MEDIA_SERVER_PID = 1,
34         OTHERS_PID = 0,
35         GETPID_FAIL = -1
36 } _pid_e;
37
38 typedef enum {
39         BLOCK_MODE = 0,
40         TIMEOUT_MODE = 1
41 } _server_mode_e;
42
43 gboolean _thumb_daemon_start_jobs(gpointer data);
44 void _thumb_daemon_finish_jobs();
45 void _thumb_daemon_mmc_eject_vconf_cb(void *data);
46 void _thumb_daemon_vconf_cb(void *data);
47 gboolean _thumb_server_prepare_socket(int *sock_fd);
48 gboolean _thumb_server_read_socket(GIOChannel *src, GIOCondition condition, gpointer data);
49
50 int _thumbnail_get_data(const char *origin_path,
51                                                 media_thumb_format format,
52                                                 char *thumb_path,
53                                                 unsigned char **data,
54                                                 int *size,
55                                                 int *width,
56                                                 int *height,
57                                                 int *origin_width,
58                                                 int *origin_height,
59                                                 int *alpha,
60                                                 bool *is_saved);
61
62 int _thumbnail_get_raw_data(const char *origin_path,
63                                                 media_thumb_format format,
64                                                 int *width,
65                                                 int *height,
66                                                 unsigned char **data,
67                                                 int *size);
68
69 int _media_thumb_process(thumbMsg *req_msg, thumbMsg *res_msg, uid_t uid);
70
71 int _media_thumb_process_raw(thumbMsg *req_msg, thumbMsg *res_msg, thumbRawAddMsg *res_raw_msg);
72
73 #endif /*_THUMB_DAEMON_INTERNAL_H_*/