Remove profile tag
[platform/core/api/media-content.git] / include / media_content.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __TIZEN_CONTENT_MEDIA_CONTENT_H__
18 #define __TIZEN_CONTENT_MEDIA_CONTENT_H__
19
20 #include <media_audio.h>
21 #include <media_filter.h>
22 #include <media_folder.h>
23 #include <media_image.h>
24 #include <media_info.h>
25 #include <media_tag.h>
26 #include <media_video.h>
27 #include <media_group.h>
28 #include <media_playlist.h>
29 #include <media_bookmark.h>
30 #include <media_face.h>
31 #include <media_book.h>
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif /* __cplusplus */
36
37 /**
38  * @file media_content.h
39  * @brief This file contains API providing functions for media content in DB. \n
40  *        Operations include connect and disconnect the media content service, scanning media file and folder with subfolders, \n
41  *        subscribing and unsubscribing notifications of media DB change.
42  */
43
44 /**
45  * @addtogroup CAPI_MEDIA_CONTENT_MODULE
46  * @{
47  */
48
49 /**
50  * @brief Connects to the media content service.
51  * @details Any media content related function call should be invoked after this function call.
52  *
53  * @since_tizen 2.3
54  *
55  * @return @c 0 on success,
56  *         otherwise a negative error value
57  *
58  * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
59  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
60  *
61  * @post media_content_disconnect()
62  *
63  * @see media_content_disconnect()
64  */
65 int media_content_connect(void);
66
67 /**
68  * @brief Disconnects from the media content service.
69  * @details This function closes connection to the media content service. Any further media content related operation
70  *          cannot be performed after this function is called.
71  *
72  * @since_tizen 2.3
73  *
74  * @return @c 0 on success,
75  *         otherwise a negative error value
76  *
77  * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
78  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
79  *
80  * @pre media_content_connect()
81  *
82  * @see media_content_connect()
83  *
84  */
85 int media_content_disconnect(void);
86
87 /**
88  * @brief Requests to scan a media file.
89  * @details This function requests to scan a media file to the media server.
90  *          If media file is not registered to DB yet, that media file information will be added to the media DB. If it is already registered to the DB, then this tries to refresh information. \n
91  *          If requested file does not exist on file system, information of the media file will be removed from the media DB. \n
92  *          If file information does not exist in DB, this function will be return #MEDIA_CONTENT_ERROR_INVALID_PARAMETER.
93  *
94  * @since_tizen 2.3
95  *
96  * @privlevel public
97  * @privilege %http://tizen.org/privilege/content.write \n
98  *                   %http://tizen.org/privilege/mediastorage \n
99  *                   %http://tizen.org/privilege/externalstorage
100  *
101  * @remarks You must add privilege %http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
102  *                   If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
103  *                   Or if you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
104  *                   If you can access both storage, you must add all privilege. \n
105  *                   Since 4.0, This function does not allow a symbolic link.\n
106  * @remarks Since 4.0, this function is related to the following feature:\n
107  *              %http://tizen.org/feature/content.scanning.others\n
108  *              If this feature is not supported on the device, MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
109  *
110  * @param[in] path The file path
111  *
112  * @return @c 0 on success,
113  *         otherwise a negative error value
114  *
115  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
116  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
117  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
118  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
119  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED    DB Operation failed
120  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY    DB Operation busy
121  * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED     Not supported
122  *
123  * @pre This function requires opened connection to content service by media_content_connect().
124  * @see media_content_connect()
125  */
126 int media_content_scan_file(const char *path);
127
128 /**
129  * @brief Requests to scan a media folder, asynchronously.
130  * @details This function requests to scan a media folder to the media server with given completed callback function.
131  *          media_scan_completed_cb() function will be called when the scanning is finished.
132  *          The sub folders are also scanned, if there are sub folders in that folder. \n
133  *          If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
134  *          After adding or removing a folder from the filesystem, call this function on its source location
135  *          (this will add or remove an entry from the database). \n
136  *          After moving or renaming a folder in the filesystem, call this function on its source location
137  *          (this will remove an entry from the database) and call this function again on its destination location
138  *          (this will add a new entry to the database).\n
139  *          Alternatively, you can call this function on any parent of source location and on any parent of destination location.\n
140  *          You can also call the function once, on a folder which is a parent of both source and destination.\n
141  *
142  * @since_tizen 2.3
143  *
144  * @privlevel public
145  * @privilege %http://tizen.org/privilege/content.write \n
146  *                   %http://tizen.org/privilege/mediastorage \n
147  *                   %http://tizen.org/privilege/externalstorage
148  *
149  * @remarks You must add privilege %http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
150  *                   If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
151  *                   Or if you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
152  *                   If you can access both storage, you must add all privilege. \n
153  *                   Since 4.0, This function does not allow a symbolic link.
154  *
155  * @param[in] path The folder path
156  * @param[in] is_recursive Set @c true to scan recursively subdirectories,
157  *                         otherwise @c false to scan only the current directory
158  * @param[in] callback The callback to be invoked when the scanning is finished
159  * @param[in] user_data The user data to be passed to the callback function
160  *
161  * @return @c 0 on success,
162  *         otherwise a negative error value
163  *
164  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
165  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
166  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
167  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
168  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
169  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED    DB Operation failed
170  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY    DB Operation busy
171  * @retval #MEDIA_CONTENT_ERROR_NETWORK   Network fail
172  *
173  * @pre This function requires opened connection to content service by media_content_connect().
174  * @see media_scan_completed_cb()
175  * @see media_content_connect()
176  */
177 int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data);
178
179 /**
180  * @brief Requests to cancel the media folder scanning.
181  * @since_tizen 2.4
182  *
183  * @param[in] path The folder path
184  *
185  * @return @c 0 on success,
186  *         otherwise a negative error value
187  *
188  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
189  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
190  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
191  *
192  * @pre media_content_scan_folder()
193  */
194 int media_content_cancel_scan_folder(const char *path);
195
196 /**
197  * @brief Subscribes notifications of the media DB change.
198  * @details This function subscribes notifications of the media DB change which are published by the media server or other apps. \n
199  *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed. \n
200  *          Using this function, multiple callback is possible to register in one process.
201  *
202  * @since_tizen 3.0
203  *
204  * @remarks The @a noti_handle should be released using media_content_remove_db_updated_cb(). \n
205  *           If you set the same callback that you previously added, this function returns MEDIA_CONTENT_ERROR_INVALID_OPERATION error. \n
206  *
207  * @param[in] callback The callback to be invoked when the scanning is finished
208  * @param[in] user_data The user data to be passed to the callback function
209  * @param[out] noti_handle The handle to db updated notification
210  *
211  * @return @c 0 on success,
212  *         otherwise a negative error value
213  *
214  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
215  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
216  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
217  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
218  *
219  * @see media_content_db_update_cb()
220  * @see media_content_remove_db_updated_cb()
221  */
222 int media_content_add_db_updated_cb(media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle);
223
224 /**
225  * @brief Removes notifications of the media DB change.
226  * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
227  *
228  * @since_tizen 3.0
229  *
230  * @param[in] noti_handle The handle to db updated notification
231  *
232  * @return @c 0 on success,
233  *         otherwise a negative error value
234  *
235  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
236  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
237  *
238  * @pre media_content_add_db_updated_cb()
239  *
240  * @see media_content_add_db_updated_cb()
241  */
242 int media_content_remove_db_updated_cb(media_content_noti_h noti_handle);
243
244 /**
245  * @}
246  */
247
248 #ifdef __cplusplus
249 }
250 #endif /* __cplusplus */
251
252 #endif /* __TIZEN_CONTENT_MEDIA_CONTENT_H__ */