Tizen 2.1 base
[framework/multimedia/media-server.git] / common / include / media-server-types.h
1 /*
2  *  Media Server
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Yong Yeon Kim <yy9875.kim@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 /**
23  * This file defines api utilities of contents manager engines.
24  *
25  * @file                media-server-types.h
26  * @author      Yong Yeon Kim(yy9875.kim@samsung.com)
27  * @version     1.0
28  * @brief
29  */
30
31 #ifndef _MEDIA_SERVER_TYPES_H_
32 #define _MEDIA_SERVER_TYPES_H_
33
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <string.h>
37 #include <stdbool.h>
38 #include <unistd.h>
39
40 #define FMS_PERF
41 #define MS_INOTI_ENABLE 0
42
43 #define MS_VALIND 1
44 #define MS_INVALID 0
45 #define MS_RECURSIVE 1
46 #define MS_NON_RECURSIVE 0
47
48 /*This macro is used to save and check information of inserted memory card*/
49 #define MS_MMC_INFO_KEY "db/private/mediaserver/mmc_info"
50
51 /* store scanning status of each storage */
52 #define MS_SCAN_STATUS_INTERNAL "file/private/mediaserver/scan_internal"
53 #define MS_SCAN_STATUS_DIRECTORY "file/private/mediaserver/scan_directory"
54 enum{
55         P_VCONF_SCAN_DOING = 0,
56         P_VCONF_SCAN_DONE,
57 };
58
59 /*Use for Poweroff sequence*/
60 #define POWEROFF_NOTI_NAME "power_off_start" /*poeroff noti from system-server*/
61 #define POWEROFF_DIR_PATH "/opt/usr/media/_POWER_OFF" /*This path uses for stopping Inotify thread and Socket thread*/
62 #define POWEROFF_DIR_NAME "_POWER_OFF" /*This path uses for stopping Inotify thread and Socket thread*/
63 #define POWEROFF -1 /*This number uses for stopping Scannig thread*/
64
65 #define MS_SAFE_FREE(src)      { if(src) {free(src); src = NULL;} }
66 #define MS_MALLOC(src, size)    { if (size > SIZE_MAX || size <= 0) {src = NULL;} \
67                                                         else { src = malloc(size); memset(src, 0x0, size);} }
68
69 /*System default folder definition*/
70 #define FAT_FILENAME_LEN_MAX          255       /* not inc null */
71 #define FAT_FILEPATH_LEN_MAX          4096      /* inc null */
72
73 /* The following MACROs(TAF_XXX) are defined in "fs-limit.h"*/
74 #define MS_FILE_NAME_LEN_MAX     FAT_FILENAME_LEN_MAX            /**< File name max length on file system */
75 #define MS_FILE_PATH_LEN_MAX     FAT_FILEPATH_LEN_MAX            /**< File path max length (include file name) on file system */
76
77 #define MS_SOCK_NOT_ALLOCATE -1
78
79 typedef enum {
80         MS_STORAGE_INTERNAL,    /**< Stored only in phone */
81         MS_STORAGE_EXTERNAL,         /**< Stored only in MMC */
82 } ms_storage_type_t;
83
84 typedef enum {
85         MS_SCANNING_INTERNAL,
86         MS_SCANNING_EXTERNAL,
87         MS_SCANNING_DIRECTORY,
88 } ms_scanning_location_t;
89
90 typedef enum {
91         MS_SCAN_INVALID,
92         MS_SCAN_PART,
93         MS_SCAN_ALL,
94 } ms_dir_scan_type_t;
95
96 typedef enum {
97         MS_DB_UPDATING = 0,
98         MS_DB_UPDATED = 1
99 } ms_db_status_type_t;
100
101 typedef struct ms_dir_scan_info {
102         char *name;
103         struct ms_dir_scan_info *parent;
104         struct ms_dir_scan_info *Rbrother;
105         struct ms_dir_scan_info *next;
106 } ms_dir_scan_info;
107
108 typedef struct {
109         char *path;
110         ms_storage_type_t storage_type;
111         ms_dir_scan_type_t scan_type;
112         int pid;
113         bool recursive_on;
114 } ms_scan_data_t;
115
116 typedef struct {
117         char *path;
118         int pid;
119 } ms_register_data_t;
120
121 /**
122  * @}
123  */
124
125 #endif /*_MEDIA_SERVER_TYPES_H_*/