1. Thumbnail extracting is enabled for burst shot
[platform/core/multimedia/libmedia-service.git] / include / media-svc.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_H_
25 #define _MEDIA_SVC_H_
26
27 #include "media-svc-types.h"
28 #include "media-svc-error.h"
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33
34 /**
35         @defgroup       MEDIA_SVC       Media Information Service
36          @{
37           * @file                       media-svc.h
38           * @brief              This file defines API's for media service.
39           * @version            1.0
40  */
41
42 /**
43         @defgroup MEDIA_SVC_API    Media Database API
44         @{
45
46         @par
47         manage the service database.
48  */
49
50
51 /**
52  *      media_svc_connect:
53  *      Connect to the media database. This is the function that an user who wants to get a handle to access the media database. 
54  *
55  *  @param              handle [out]            Handle to access database.
56  *      @return         This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
57  *                              Please refer 'media-info-error.h' to know the exact meaning of the error.
58  *      @see            media_svc_disconnect
59  *      @pre            None
60  *      @post           call media_svc_disconnect to disconnect media database.
61  *      @remark The database name is "/opt/usr/dbspace/.media.db".
62  *      @par example
63  *      @code
64
65 #include <media-info.h>
66
67 void connect_media_db()
68 {
69         int ret = MEDIA_INFO_ERROR_NONE;
70         MediaSvcHandle* my_handle = NULL;
71
72         // connect to the media database
73         ret = media_svc_connect(&my_handle);
74
75         if (ret < 0)
76         {
77                 printf("Fatal error to connect DB\n");
78                 return;
79         }
80
81         return;
82 }
83
84  *      @endcode
85  */
86 int media_svc_connect(MediaSvcHandle **handle);
87
88
89 /**
90  *      media_svc_disconnect:
91  *      Disconnect to the media database. This is the function that an user who wants to disconnect the media database. 
92  *
93  *  @param              handle [in]             Handle to access database.
94  *      @return         This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
95  *                              Please refer 'media-info-error.h' to know the exact meaning of the error.
96  *      @see            media_svc_connect
97  *      @pre            call media_svc_connect to connect media database.
98  *      @post           None
99  *      @remark The database name is "/opt/usr/dbspace/.media.db".
100  *      @par example
101  *      @code
102
103 #include <media-info.h>
104
105 void disconnect_media_db()
106 {
107         int ret = MEDIA_INFO_ERROR_NONE;
108         MediaSvcHandle* my_handle = NULL;
109
110         // connect to the media database
111         ret = media_svc_connect(&my_handle);
112
113         if (ret < 0)
114         {
115                 printf("Fatal error to connect DB\n");
116                 return;
117         }
118
119         //
120         // Do something using my_handle
121         //
122         
123
124         ret = media_svc_disconnect(my_handle);
125         if (ret < 0)
126         {
127                 printf("Fatal error to disconnect DB\n");
128         }
129
130         return;
131 }
132
133  *      @endcode
134  */
135 int media_svc_disconnect(MediaSvcHandle *handle);
136
137
138 /**
139  *      media_svc_create_table:
140  *      Create table of media database and set Index and Triggers.
141  *
142  *  @param              handle [in]             Handle to access database.
143  *      @return         This function returns zero(MEDIA_INFO_ERROR_NONE) on success, or negative value with error code.
144  *                              Please refer 'media-info-error.h' to know the exact meaning of the error.
145  *      @see            None
146  *      @pre            call media_svc_connect to connect media database.
147  *      @post           call media_svc_disconnect to disconnect media database.
148  *      @remark The database name is "/opt/usr/dbspace/.media.db".
149  *      @par example
150  *      @code
151
152 #include <media-info.h>
153
154 void create_media_db_table()
155 {
156         int ret = MEDIA_INFO_ERROR_NONE;
157         MediaSvcHandle* my_handle = NULL;
158
159         // connect to the media database
160         ret = media_svc_connect(&my_handle);
161
162         if (ret < 0)
163         {
164                 printf("Fatal error to connect DB\n");
165                 return;
166         }
167
168         ret = media_svc_create_table(my_handle);
169         if (ret < 0)
170         {
171                 printf("Fatal error to create DB table\n");
172         }
173
174         ret = media_svc_disconnect(my_handle);
175         if (ret < 0)
176         {
177                 printf("Fatal error to disconnect DB\n");
178         }
179
180         return;
181 }
182
183  *      @endcode
184  */
185
186 int media_svc_create_table(MediaSvcHandle *handle);
187
188 int media_svc_check_item_exist_by_path(MediaSvcHandle *handle, const char *path);
189
190 int media_svc_insert_folder(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path);
191
192 int media_svc_insert_item_begin(MediaSvcHandle *handle, int with_noti, int data_cnt, int from_pid);
193
194 int media_svc_insert_item_end(MediaSvcHandle *handle);
195
196 int media_svc_insert_item_bulk(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path, int is_burst);
197
198 int media_svc_insert_item_immediately(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path);
199
200 int media_svc_move_item_begin(MediaSvcHandle *handle, int data_cnt);
201
202 int media_svc_move_item_end(MediaSvcHandle *handle);
203
204 int media_svc_move_item(MediaSvcHandle *handle, media_svc_storage_type_e src_storage, const char *src_path, media_svc_storage_type_e dest_storage, const char *dest_path);
205
206 int media_svc_set_item_validity_begin(MediaSvcHandle *handle, int data_cnt);
207
208 int media_svc_set_item_validity_end(MediaSvcHandle *handle);
209
210 int media_svc_set_item_validity(MediaSvcHandle *handle, const char *path, int validity);
211
212 int media_svc_delete_item_by_path(MediaSvcHandle *handle, const char *path);
213
214 int media_svc_delete_all_items_in_storage(MediaSvcHandle *handle, media_svc_storage_type_e storage_type);
215
216 int media_svc_delete_invalid_items_in_storage(MediaSvcHandle *handle, media_svc_storage_type_e storage_type);
217
218 int media_svc_delete_invalid_items_in_folder(MediaSvcHandle *handle, const char *folder_path);
219
220 int media_svc_set_all_storage_items_validity(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, int validity);
221
222 int media_svc_set_folder_items_validity(MediaSvcHandle *handle, const char *folder_path, int validity, int recursive);
223
224 int media_svc_refresh_item(MediaSvcHandle *handle, media_svc_storage_type_e storage_type, const char *path);
225
226 int media_svc_rename_folder(MediaSvcHandle *handle, const char *src_path, const char *dst_path);
227
228 int media_svc_request_update_db(const char *db_query);
229
230 int media_svc_get_storage_type(const char *path, media_svc_storage_type_e *storage_type);
231
232 int media_svc_get_mime_type(const char *path, char *mimetype);
233
234 int media_svc_get_media_type(const char *path, const char *mime_type, media_svc_media_type_e *media_type);
235
236 int media_svc_send_dir_update_noti(MediaSvcHandle *handle, const char *dir_path);
237
238 /** @} */
239
240 /**
241         @}
242  */
243
244 #ifdef __cplusplus
245 }
246 #endif
247
248 #endif /*_MEDIA_SVC_H_*/