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