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