modify DB schema.
[platform/core/multimedia/libmedia-service.git] / src / include / common / media-svc-env.h
1 /*
2  * libmedia-service
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Hyunjun Ko <zzoon.ko@samsung.com>, Haejeong Kim <backto.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
24 #ifndef _MEDIA_SVC_ENV_H_
25 #define _MEDIA_SVC_ENV_H_
26
27 #include <time.h>
28 #include <media-util.h>
29 #include <tzplatform_config.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 /**
36  * DB information
37  */
38
39 #define MEDIA_SVC_DB_NAME                                               MEDIA_DB_NAME           /**<  media db name*/
40 #define LATEST_VERSION_NUMBER                                   2
41
42 /**
43  * DB table information
44  */
45
46 #define MEDIA_SVC_DB_TABLE_MEDIA                                        "media"                         /**<  media table*/
47 #define MEDIA_SVC_DB_TABLE_FOLDER                                       "folder"                                /**<  media_folder table*/
48 #define MEDIA_SVC_DB_TABLE_PLAYLIST                             "playlist"                              /**<  playlist table*/
49 #define MEDIA_SVC_DB_TABLE_PLAYLIST_MAP                 "playlist_map"                  /**<  playlist_map table*/
50 #define MEDIA_SVC_DB_TABLE_ALBUM                                        "album"                         /**<  album table*/
51 #define MEDIA_SVC_DB_TABLE_TAG                                  "tag"                           /**<  tag table*/
52 #define MEDIA_SVC_DB_TABLE_TAG_MAP                              "tag_map"                       /**<  tag_map table*/
53 #define MEDIA_SVC_DB_TABLE_BOOKMARK                             "bookmark"                      /**<  bookmark table*/
54 #define MEDIA_SVC_DB_TABLE_CUSTOM                               "custom"                                /**<  custom table*/
55
56
57 #define MEDIA_SVC_METADATA_LEN_MAX                      128                                             /**<  Length of metadata*/
58 #define MEDIA_SVC_METADATA_DESCRIPTION_MAX      512                                             /**<  Length of description*/
59 #define MEDIA_SVC_PATHNAME_SIZE                         4096                                    /**<  Length of Path name. */
60 #define MEDIA_SVC_UUID_SIZE                                             36                                              /**< Length of UUID*/
61
62 #define MEDIA_SVC_TAG_UNKNOWN                           "Unknown"
63 #define MEDIA_SVC_MEDIA_PATH                            tzplatform_mkpath(TZ_USER_DATA, "file-manager-service")                 /**<  Media path*/
64 #define MEDIA_SVC_THUMB_PATH_PREFIX                     tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb")                  /**< Thumbnail path prefix*/
65 #define MEDIA_SVC_THUMB_INTERNAL_PATH           tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/phone")    /**<  Phone thumbnail path*/
66 #define MEDIA_SVC_THUMB_EXTERNAL_PATH           tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/mmc")              /**<  MMC thumbnail path*/
67 #define MEDIA_SVC_THUMB_DEFAULT_PATH            tzplatform_mkpath(TZ_USER_DATA, "file-manager-service/.thumb/thumb_default.png") /** default thumbnail */
68
69 #define MEDIA_SVC_DEFAULT_GPS_VALUE                     -200                    /**<  Default GPS Value*/
70 #define THUMB_EXT       "jpg"
71
72 #define MEDIA_SVC_PATH_PHONE                            MEDIA_ROOT_PATH_INTERNAL
73 #define MEDIA_SVC_PATH_MMC                                      MEDIA_ROOT_PATH_SDCARD
74
75 enum Exif_Orientation {
76     NOT_AVAILABLE=0,
77     NORMAL  =1,
78     HFLIP   =2,
79     ROT_180 =3,
80     VFLIP   =4,
81     TRANSPOSE   =5,
82     ROT_90  =6,
83     TRANSVERSE  =7,
84     ROT_270 =8
85 };
86
87 #if 0
88 /**
89  * Media meta data information
90  */
91 typedef struct {
92         char            title[MEDIA_SVC_METADATA_LEN_MAX];                              /**< track title*/
93         char            album[MEDIA_SVC_METADATA_LEN_MAX];                      /**< album name*/
94         char            artist[MEDIA_SVC_METADATA_LEN_MAX];                     /**< artist name*/
95         char            genre[MEDIA_SVC_METADATA_LEN_MAX];                      /**< genre of track*/
96         char            author[MEDIA_SVC_METADATA_LEN_MAX];                     /**< author name*/
97         char            year[MEDIA_SVC_METADATA_LEN_MAX];                               /**< author name*/
98         char            recorded_date[MEDIA_SVC_METADATA_LEN_MAX];              /**< recorded date*/
99         char            copyright[MEDIA_SVC_METADATA_LEN_MAX];                  /**< copyright*/
100         char            track_num[MEDIA_SVC_METADATA_LEN_MAX];          /**< track number*/
101         char            description[MEDIA_SVC_METADATA_DESCRIPTION_MAX];        /**< description*/
102         int             bitrate;                                                                                        /**< bitrate*/
103         int             samplerate;                                                                             /**< samplerate*/
104         int             channel;                                                                                        /**< channel*/
105         int             duration;                                                                               /**< duration*/
106         float           longitude;                                                                              /**< longitude*/
107         float           latitude;                                                                                       /**< latitude*/
108         float           altitude;                                                                                       /**< altitude*/
109         int             width;                                                                                  /**< width*/
110         int             height;                                                                                 /**< height*/
111         char            datetaken[MEDIA_SVC_METADATA_LEN_MAX];          /**< datetaken*/
112         char            timetaken[MEDIA_SVC_METADATA_LEN_MAX];          /**< timetaken*/
113         int             orientation;                                                                            /**< orientation*/
114         int             rating;                                                                                 /**< user defined rating */
115 } media_svc_content_meta_s;
116
117
118 /**
119  * Media data information
120  */
121 typedef struct {
122         char            media_uuid[MEDIA_SVC_UUID_SIZE+1];                      /**< Unique ID of item */
123         char            path[MEDIA_SVC_PATHNAME_SIZE];                          /**< Full path and file name of media file */
124         char            file_name[MEDIA_SVC_PATHNAME_SIZE];                     /**< Full path and file name of media file */
125         int             media_type;                                                                     /**< Type of media file : internal/external */
126         char            mime_type[MEDIA_SVC_PATHNAME_SIZE];                     /**< Full path and file name of media file */
127         int             size;
128         int             added_time;                                                                     /**< added time */
129         int             modified_time;                                                          /**< modified time */
130         char            folder_uuid[MEDIA_SVC_UUID_SIZE+1];                     /**< Unique ID of folder */
131         int             album_id;                                                                       /**< Unique ID of album */
132         char            thumbnail_path[MEDIA_SVC_PATHNAME_SIZE];                /**< Thumbnail image file path */
133         int             played_count;                                                           /**< played count */
134         int             last_played_time;                                                                       /**< last played time */
135         int             last_played_position;
136         int             favourate;                                                                      /**< favourate. o or 1 */
137         int             hiding;                                                                         /**< hiding. o or 1 */
138         int             is_drm;                                                                         /**< is_drm. o or 1 */
139         int             storage_type;                                                                   /**< Storage of media file : internal/external */
140         media_svc_content_meta_s                media_meta;                                     /**< meta data structure for audio files */
141 } media_svc_content_info_s;
142 #else
143 /**
144  * Media meta data information
145  */
146 typedef struct {
147         char    *       title;                          /**< track title*/
148         char    *       album;                          /**< album name*/
149         char    *       artist;                         /**< artist name*/
150         char    *       album_artist;           /**< artist name*/
151         char    *       genre;                          /**< genre of track*/
152         char    *       composer;                       /**< composer name*/
153         char    *       year;                           /**< year*/
154         char    *       recorded_date;          /**< recorded date*/
155         char    *       copyright;                      /**< copyright*/
156         char    *       track_num;                      /**< track number*/
157         char    *       description;                    /**< description*/
158         int             bitrate;                                /**< bitrate*/
159         int             samplerate;                     /**< samplerate*/
160         int             channel;                                /**< channel*/
161         int             duration;                       /**< duration*/
162         float           longitude;                      /**< longitude*/
163         float           latitude;                               /**< latitude*/
164         float           altitude;                               /**< altitude*/
165         int             width;                          /**< width*/
166         int             height;                         /**< height*/
167         char    *       datetaken;                      /**< datetaken*/
168         int             orientation;                    /**< orientation*/
169         int             rating;                         /**< user defined rating */
170         char    *       weather;                                /**< weather of image */
171
172         char    *       file_name_pinyin;                               /**< pinyin for file_name*/
173         char    *       title_pinyin;                                   /**< pinyin for title*/
174         char    *       album_pinyin;                           /**< pinyin for album*/
175         char    *       artist_pinyin;                                  /**< pinyin for artist*/
176         char    *       album_artist_pinyin;                    /**< pinyin for album_artist*/
177         char    *       genre_pinyin;                                   /**< pinyin for genre*/
178         char    *       composer_pinyin;                                /**< pinyin for composer*/
179         char    *       copyright_pinyin;                               /**< pinyin for copyright*/
180         char    *       description_pinyin;                     /**< pinyin for description*/
181 } media_svc_content_meta_s;
182
183
184 /**
185  * Media data information
186  */
187 typedef struct {
188         char    *       media_uuid;                                     /**< Unique ID of item */
189         char    *       path;                                           /**< Full path of media file */
190         char    *       file_name;                                      /**< File name of media file. Display name */
191         char    *       file_name_pinyin;                               /**< File name pinyin of media file. Display name */
192         int             media_type;                                     /**< Type of media file : internal/external */
193         char    *       mime_type;                                      /**< Full path and file name of media file */
194         unsigned long long      size;                                                   /**< size */
195         time_t  added_time;                                     /**< added time, time_t */
196         time_t  modified_time;                          /**< modified time, time_t */
197         time_t  timeline;                                       /**< timeline of media, time_t */
198         char    *       folder_uuid;                                    /**< Unique ID of folder */
199         int             album_id;                                       /**< Unique ID of album */
200         char    *       thumbnail_path;                         /**< Thumbnail image file path */
201         int             played_count;                           /**< played count */
202         int             last_played_time;                               /**< last played time */
203         int             last_played_position;                   /**< last played position */
204         int             favourate;                                      /**< favourate. o or 1 */
205         int             is_drm;                                         /**< is_drm. o or 1 */
206         int             sync_status;                                            /**< sync_status  */
207         int             storage_type;                                   /**< Storage of media file : internal/external */
208         media_svc_content_meta_s        media_meta;     /**< meta data structure for audio files */
209 } media_svc_content_info_s;
210 #endif
211
212 typedef enum{
213         MEDIA_SVC_QUERY_INSERT_ITEM,
214         MEDIA_SVC_QUERY_SET_ITEM_VALIDITY,
215         MEDIA_SVC_QUERY_MOVE_ITEM,
216 } media_svc_query_type_e;
217
218 #ifdef __cplusplus
219 }
220 #endif
221
222 #endif /*_MEDIA_SVC_ENV_H_*/