Just update api description
[platform/core/api/media-content.git] / include_product / media_folder.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
18 #ifndef __TIZEN_CONTENT_MEDIA_FOLDER_H__
19 #define __TIZEN_CONTENT_MEDIA_FOLDER_H__
20
21
22 #include <media_content_type.h>
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 /**
30  * @file media_folder.h
31  * @brief This file contains API related to all operations with media folder in DB. \n
32  *        These functions include getting the number of folders and media files filtered from DB,  \n
33  *        iterating through media files and folders filtered in the given folder from DB;  \n
34  *        cloning and destroying the media folder, getting its name, ID, absolute path and date \n
35  *        and updating the media folder to the media database.
36  */
37
38 /**
39  * @addtogroup CAPI_CONTENT_MEDIA_FOLDER_MODULE
40  * @{
41  */
42
43
44 /**
45  * @brief Gets the count of folder for the passed @a filter from the media database.
46  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
47  *
48  * @param[in] filter The handle to the media filter
49  * @param[out] folder_count The count of the media folder
50  *
51  * @return @c 0 on success,
52  *         otherwise a negative error value
53  *
54  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
55  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
56  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
57  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
58  *
59  * @pre This function requires opened connection to content service by media_content_connect().
60  *
61  * @see media_content_connect()
62  */
63 int media_folder_get_folder_count_from_db(filter_h filter, int *folder_count);
64
65 /**
66  * @brief Iterates through available media folders with optional @a filter from the media database.
67  * @details This function gets the media folder meeting the given @a filter.
68  *          The @a callback function will be invoked for every retrieved
69  *          folder. If @c NULL is passed to the @a filter, no filtering is applied.
70  *
71  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72  *
73  * @remarks Do not call updating DB function like media_folder_update_to_db() in your callback function, your callback function is invoked as inline function.\n
74  *                   So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
75  *                   We do not recommend you call updating DB function in callback of foreach function.
76  *
77  * @param[in] filter The handle to the media filter
78  * @param[in] callback The callback function to be invoked
79  * @param[in] user_data The user data to be passed to the callback function
80  *
81  * @return @c 0 on success,
82  *         otherwise a negative error value
83  *
84  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
85  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
86  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
87  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
88  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
89  *
90  * @pre  This function requires opened connection to content service by media_content_connect().
91  * @pre  A filter handle has to be created by calling media_filter_create().
92  * @post This function invokes media_folder_cb().
93  *
94  * @see media_content_connect()
95  * @see media_folder_cb()
96  * @see media_filter_create()
97  */
98 int media_folder_foreach_folder_from_db(filter_h filter, media_folder_cb callback, void *user_data);
99
100 /**
101  * @brief Gets the count of media files for the passed @a filter in the given @a folder_id from the media database.
102  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
103  *
104  * @param[in] folder_id The ID of the media folder
105  * @param[in] filter The handle to the media filter
106  * @param[out] media_count The count of media folder items
107  *
108  * @return @c 0 on success,
109  *         otherwise a negative error value
110  *
111  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
112  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
113  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
114  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
115  *
116  * @pre This function requires opened connection to content service by media_content_connect().
117  *
118  * @see media_content_connect()
119  */
120 int media_folder_get_media_count_from_db(const char *folder_id, filter_h filter, int *media_count);
121
122 /**
123  * @brief Iterates through the media files with an optional @a filter in the given @a folder_id from the media database.
124  * @details This function gets all media files associated with the given folder and
125  *          meeting desired filter option and calls @a callback for
126  *          every retrieved media item. If @c NULL is passed to the @a filter, no filtering is applied.
127  *
128  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
129  *
130  * @remarks   Do not call updating DB function like media_info_update_to_db(), media_info_refresh_metadata_to_db(), audio_meta_update_to_db(), image_meta_update_to_db() and video_meta_update_to_db()  in your callback function,
131  *                    your callback function is invoked as inline function. \n
132  *                    So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB. \n
133  *                    We do not recommend you call updating DB function in callback of foreach function.
134  *
135  * @param[in] folder_id The ID of the media folder
136  * @param[in] filter The handle to the media filter
137  * @param[in] callback The callback function to be invoked
138  * @param[in] user_data The user data to be passed to the callback function
139  *
140  * @return @c 0 on success,
141  *         otherwise a negative error value
142  *
143  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
144  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
145  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
146  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
147  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
148  *
149  * @pre  This function requires opened connection to content service by media_content_connect().
150  * @post This function invokes media_info_cb().
151  *
152  * @see #media_info_cb
153  * @see media_content_connect()
154  * @see media_filter_create()
155  */
156 int media_folder_foreach_media_from_db(const char *folder_id, filter_h filter, media_info_cb callback, void *user_data);
157
158 /**
159  * @brief Clones the media folder.
160  * @details This function copies the media folder handle from a source to
161  *          destination. There is no media_folder_create() function. The media_folder_h is created internally and available through
162  *          media folder foreach function such as media_folder_foreach_folder_from_db(). To use this handle outside of these foreach functions,
163  *          use this function.
164  *
165  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
166  *
167  * @remarks The @a dst should be released using media_folder_destroy().
168  *
169  * @param[out] dst The destination handle to the media folder
170  * @param[in] src The source handle to the media folder
171  *
172  * @return @c 0 on success,
173  *         otherwise a negative error value
174  *
175  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
176  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
177  *
178  * @see media_folder_destroy()
179  * @see media_folder_foreach_folder_from_db()
180  */
181 int media_folder_clone(media_folder_h *dst, media_folder_h src);
182
183 /**
184  * @brief Destroys the media folder.
185  * @details The function frees all resources related to the folder handle. This handle
186  *          no longer can be used to perform any operations. A new handle has to
187  *          be created before the next use.
188  *
189  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
190  *
191  * @param[in] folder The handle to the media folder
192  *
193  * @return @c 0 on success,
194  *         otherwise a negative error value
195  *
196  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
197  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
198  *
199  * @pre A copy of the media folder handle created by calling media_folder_clone().
200  *
201  * @see media_folder_clone()
202  */
203 int media_folder_destroy(media_folder_h folder);
204
205 /**
206  * @brief Gets the media folder ID.
207  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
208  *
209  * @remarks The @a folder_id should be released using free().
210  *
211  * @param[in] folder The handle to the media folder
212  * @param[out] folder_id The ID of the media folder
213  *
214  * @return @c 0 on success,
215  *         otherwise a negative error value
216  *
217  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
218  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
219  */
220 int media_folder_get_folder_id(media_folder_h folder, char **folder_id);
221
222 /**
223  * @deprecated Deprecated since 4.0.
224  * @brief Gets the parent folder ID.
225  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
226  *
227  * @remarks The @a parent_folder_id should be released using free().
228  *
229  * @param[in] folder The handle to the media folder
230  * @param[out] parent_folder_id The ID of the upper media folder
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 int media_folder_get_parent_folder_id(media_folder_h folder, char **parent_folder_id) TIZEN_DEPRECATED_API;
239
240 /**
241  * @brief Gets the absolute path to the media folder.
242  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
243  *
244  * @remarks The @a path should be released using free().
245  *
246  * @param[in] folder The handle to the media folder
247  * @param[out] path The path of the media folder
248  *
249  * @return @c 0 on success,
250  *         otherwise a negative error value
251  *
252  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
253  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
254  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
255  *
256  */
257 int media_folder_get_path(media_folder_h folder, char **path);
258
259 /**
260  * @brief Gets the media folder name.
261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
262  *
263  * @remarks The @a folder_name should be released using free().
264  *
265  * @param[in] folder The handle to the media folder
266  * @param[out] folder_name The name of the media folder
267  *
268  * @return @c 0 on success,
269  *         otherwise a negative error value
270  *
271  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
272  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
273  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
274  */
275 int media_folder_get_name(media_folder_h folder, char **folder_name);
276
277 /**
278  * @deprecated Deprecated since 4.0.
279  * @brief Gets the modified date of the folder.
280  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
281  *
282  * @param[in] folder The handle to the media folder
283  * @param[out] date The modified date of the media folder
284  *
285  * @return @c 0 on success,
286  *         otherwise a negative error value
287  *
288  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
289  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
290  */
291 int media_folder_get_modified_time(media_folder_h folder, time_t *date) TIZEN_DEPRECATED_API;
292
293 /**
294  * @brief Gets the folder storage type.
295  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
296  *
297  * @param[in] folder The handle to the media folder
298  * @param[out] storage_type The storage type of the media folder
299  *
300  * @return @c 0 on success,
301  *         otherwise a negative error value
302  *
303  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
304  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
305  */
306 int media_folder_get_storage_type(media_folder_h folder, media_content_storage_e *storage_type);
307
308 /**
309  * @brief Gets the storage id of the folder.
310  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
311  *
312  * @remarks The @a storage_id should be released using free().
313  *
314  * @param[in] folder The handle to the media folder
315  * @param[out] storage_id The storage id of the media folder
316  *
317  * @return @c 0 on success,
318  *         otherwise a negative error value
319  *
320  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
321  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
322  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
323  */
324 int media_folder_get_storage_id(media_folder_h folder, char **storage_id);
325
326 /**
327  * @deprecated Deprecated since 4.0. \n
328  *         This function does not guarantee order independence between applications. It is recommended that the viewing order is managed by the application.
329  *
330  * @brief Gets the folder viewing order.
331  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
332  *
333  * @param[in] folder The handle to the media folder
334  * @param[out] order The viewing order of the media folder
335  *
336  * @return @c 0 on success,
337  *         otherwise a negative error value
338  *
339  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
340  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
341  *
342  * @post media_folder_update_to_db()
343  */
344 int media_folder_get_order(media_folder_h folder, int *order) TIZEN_DEPRECATED_API;
345
346 /**
347  * @brief Gets the media folder from the media database.
348  *
349  * @details This function creates a new media folder handle from the media database by the given @a folder_id.
350  *          Media folder will be created, which is filled with folder information.
351  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352  *
353  * @remarks The @a folder should be released using media_folder_destroy().
354  *
355  * @param[in] folder_id The ID of the media folder
356  * @param[out] folder The handle to the media folder
357  *
358  * @return @c 0 on success,
359  *         otherwise a negative error value
360  *
361  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
362  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
363  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
364  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
365  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
366  *
367  * @pre This function requires opened connection to content service by media_content_connect().
368  *
369  * @see media_content_connect()
370  * @see media_folder_destroy()
371  *
372  */
373 int media_folder_get_folder_from_db(const char *folder_id, media_folder_h *folder);
374
375 /**
376  * @deprecated Deprecated since 4.0. Use media_content_scan_folder() or media_info_move_to_db() instead.
377  * @brief Sets the folder name.
378  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
379  *
380  * @param[in] folder The handle to the media folder
381  * @param[in] name The name of the media folder
382  *
383  * @return @c 0 on success,
384  *         otherwise a negative error value
385  *
386  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
387  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
388  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
389  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
390  */
391 int media_folder_set_name(media_folder_h folder, const char *name) TIZEN_DEPRECATED_API;
392
393 /**
394  * @deprecated Deprecated since 4.0. \n
395  *         This function does not guarantee order independence between applications. It is recommended that the viewing order is managed by the application.
396  * @brief Sets the folder viewing order.
397  * @details If you set the order value for each folder, you can sort in ascending or descending order as the set order values using the filter. \n
398  *                 Moreover, more detailed settings are possible when used with the filter. \n
399  *
400  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
401  * @remarks  If you don't set the order value, the order value will be set default value. Default is 0. \n
402  *                    If you don't use the filter, the set order value does not effect the folder viewing order.
403  *
404  * @param[in] folder The handle to the media folder
405  * @param[in] order The viewing order of the media folder
406  *
407  * @return @c 0 on success,
408  *         otherwise a negative error value
409  *
410  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
411  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
412  */
413 int media_folder_set_order(media_folder_h folder, int order) TIZEN_DEPRECATED_API;
414
415 /**
416  * @deprecated Deprecated since 4.0. Related setter functions are deprecated, therefore this function is not needed anymore.
417  * @brief Updates the media folder to the media database.
418  *
419  * @details The function updates the given media folder in the media database. The function should be called after any change in folder attributes, to be updated to the media
420  *          database.
421  *
422  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
423  *
424  * @privlevel public
425  * @privilege %http://tizen.org/privilege/content.write
426  *
427  * @param[in] folder The handle to the media folder
428  *
429  * @return @c 0 on success,
430  *         otherwise a negative error value
431  *
432  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
433  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
434  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
435  * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
436  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED         DB Operation failed
437  * @retval #MEDIA_CONTENT_ERROR_DB_BUSY           DB Operation busy
438  * @retval #MEDIA_CONTENT_ERROR_NETWORK           Network fail
439  * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
440  *
441  * @pre This function requires opened connection to content service by media_content_connect().
442  *
443  * @see media_content_connect()
444  * @see media_folder_destroy()
445  */
446 int media_folder_update_to_db(media_folder_h folder) TIZEN_DEPRECATED_API;
447
448 /**
449  * @}
450  */
451
452 #ifdef __cplusplus
453 }
454 #endif /* __cplusplus */
455
456 #endif /* __TIZEN_CONTENT_MEDIA_FOLDER_H__ */