Revert "Revert "Add description for deprecation""
[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_MEDIA_CONTENT_H__
18 #define __TIZEN_MEDIA_CONTENT_H__
19
20 #include <media_audio.h>
21 #include <media_content_type.h>
22 #include <media_filter.h>
23 #include <media_folder.h>
24 #include <media_image.h>
25 #include <media_info.h>
26 #include <media_tag.h>
27 #include <media_video.h>
28 #include <media_group.h>
29 #include <media_playlist.h>
30 #include <media_bookmark.h>
31 #include <media_storage.h>
32 #include <media_face.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif /* __cplusplus */
37
38 /**
39  * @file media_content.h
40  * @brief This file contains API providing functions for media content in DB. \n
41  *        Operations include connect and disconnect the media content service, scanning media file and folder with subfolders, \n
42  *        subscribing and unsubscribing notifications of media DB change.
43  */
44
45 /**
46  * @addtogroup CAPI_MEDIA_CONTENT_MODULE
47  * @{
48  */
49
50 /**
51  * @brief Connects to the media content service.
52  * @details Any media content related function call should be invoked after this function call.
53  *
54  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
55  *
56  * @return @c 0 on success,
57  *         otherwise a negative error value
58  *
59  * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
60  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
61  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
62  *
63  * @post media_content_disconnect()
64  *
65  * @see media_content_disconnect()
66  */
67 int media_content_connect(void);
68
69 /**
70  * @brief Disconnects from the media content service.
71  * @details This function closes connection to the media content service. Any further media content related operation
72  *          cannot be performed after this function is called.
73  *
74  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
75  *
76  * @return @c 0 on success,
77  *         otherwise a negative error value
78  *
79  * @retval #MEDIA_CONTENT_ERROR_NONE      Successful
80  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
81  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
82  *
83  * @pre media_content_connect()
84  *
85  * @see media_content_connect()
86  *
87  */
88 int media_content_disconnect(void);
89
90 /**
91  * @brief Requests to scan a media file.
92  * @details This function requests to scan a media file to the media server.
93  *          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.
94  *          If requested file does not exist on file system, information of the media file will be removed from the media DB.
95  *
96  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
97  *
98  * @privlevel public
99  * @privilege %http://tizen.org/privilege/content.write \n
100  *                   %http://tizen.org/privilege/mediastorage \n
101  *                   %http://tizen.org/privilege/externalstorage
102  *
103  * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
104  *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
105  *                   Or if you want to access only external storage by using  this API, you should add privilege http://tizen.org/privilege/externalstorage. \n
106  *                   If you can access both storage, you must add all privilege.
107  *
108  * @param[in] path The file path
109  *
110  * @return @c 0 on success,
111  *         otherwise a negative error value
112  *
113  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
114  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
115  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
116  *
117  * @pre This function requires opened connection to content service by media_content_connect().
118  */
119 int media_content_scan_file(const char *path);
120
121 /**
122  * @brief Requests to scan a media folder, asynchronously.
123  * @details This function requests to scan a media folder to the media server with given completed callback function.
124  *          media_scan_completed_cb() function will be called when the scanning is finished.
125  *          The sub folders are also scanned, if there are sub folders in that folder. \n
126  *          If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder.
127  *
128  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
129  *
130  * @privlevel public
131  * @privilege %http://tizen.org/privilege/content.write \n
132  *                   %http://tizen.org/privilege/mediastorage \n
133  *                   %http://tizen.org/privilege/externalstorage
134  *
135  * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
136  *                   If you want to access only internal storage by using  this API, you should add privilege http://tizen.org/privilege/mediastorage. \n
137  *                   Or if you want to access only external storage by using  this API, you should add privilege http://tizen.org/privilege/externalstorage. \n
138  *                   If you can access both storage, you must add all privilege.
139  *
140  * @param[in] path         The folder path
141  * @param[in] is_recursive Set @c true to scan recursively subdirectories,
142  *                         otherwise @c false to scan only the current directory
143  * @param[in] callback     The callback to be invoked when the scanning is finished
144  * @param[in] user_data    The user data to be passed to the callback function
145  *
146  * @return @c 0 on success,
147  *         otherwise a negative error value
148  *
149  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
150  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
151  *
152  * @see media_scan_completed_cb()
153  */
154 int media_content_scan_folder(const char *path, bool is_recursive, media_scan_completed_cb callback, void *user_data);
155
156 /**
157  * @brief Requests to cancel the media folder scanning.
158  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
159  *
160  * @param[in] path         The folder path
161  *
162  * @return @c 0 on success,
163  *         otherwise a negative error value
164  *
165  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
166  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
167  *
168  * @pre media_content_scan_folder()
169  */
170 int media_content_cancel_scan_folder(const char *path);
171
172 /**
173  * @deprecated Deprecated since 3.0. Use media_content_add_db_updated_cb() instead.
174  * @brief Subscribes notifications of the media DB change.
175  * @details This function subscribes notifications of the media DB change which are published by the media server or other apps.
176  *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed.
177  *
178  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
179  *
180  * @param[in] callback  The callback to be invoked when the scanning is finished
181  * @param[in] user_data The user data to be passed to the callback function
182  *
183  * @return @c 0 on success,
184  *         otherwise a negative error value
185  *
186  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
187  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
188  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
189  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
190  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
191  *
192  * @see media_content_db_update_cb()
193  * @see media_content_unset_db_updated_cb()
194  */
195 int media_content_set_db_updated_cb(media_content_db_update_cb callback, void *user_data) TIZEN_DEPRECATED_API;
196
197 /**
198  * @deprecated Deprecated since 3.0. Use media_content_remove_db_updated_cb() instead.
199  * @brief Unsubscribes notifications of the media DB change.
200  * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
201  *
202  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
203  *
204  * @return @c 0 on success,
205  *         otherwise a negative error value
206  *
207  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
208  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
209  *
210  * @pre media_content_set_db_updated_cb()
211  *
212  * @see media_content_set_db_updated_cb()
213  */
214 int media_content_unset_db_updated_cb(void) TIZEN_DEPRECATED_API;
215
216 /**
217  * @brief Subscribes notifications of the media DB change.
218  * @details This function subscribes notifications of the media DB change which are published by the media server or other apps. \n
219  *          media_content_db_update_cb() function will be called when notification of the media DB change is subscribed. \n
220  *          Using this API, multiple callback is possible to register in one process.
221  *
222  * @since_tizen 3.0
223  *
224  * @remarks  To release the registered callback, you must use media_content_remove_db_updated_cb() API. \n
225  *                    media_content_unset_db_updated_cb() API can not release the callbacks added by this API. \n
226  *                    If you set the same callback that you previously added, this API returns MEDIA_CONTENT_ERROR_INVALID_OPERATION error. \n
227  *
228  * @param[in] callback  The callback to be invoked when the scanning is finished
229  * @param[in] user_data The user data to be passed to the callback function
230  * @param[out] 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  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
238  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
239  *
240  * @see media_content_db_update_cb()
241  * @see media_content_remove_db_updated_cb()
242  */
243 int media_content_add_db_updated_cb(media_content_db_update_cb callback, void *user_data, media_content_noti_h *noti_handle);
244
245
246 /**
247  * @brief Unsubscribes notifications of the media DB change.
248  * @details This function unsubscribes notifications of the media DB change which are published by the media server or other apps.
249  *
250  * @since_tizen 3.0
251  *
252  * @param[in] noti_handle The handle to db updated notification
253  *
254  * @return @c 0 on success,
255  *         otherwise a negative error value
256  *
257  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
258  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
259  *
260  * @pre media_content_add_db_updated_cb()
261  *
262  * @see media_content_add_db_updated_cb()
263  */
264 int media_content_remove_db_updated_cb(media_content_noti_h noti_handle);
265
266 /**
267  * @}
268  */
269
270 #ifdef __cplusplus
271 }
272 #endif /* __cplusplus */
273
274 #endif /* __TIZEN_MEDIA_CONTENT_H__ */