2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TIZEN_CONTENT_MEDIA_INFO_H__
19 #define __TIZEN_CONTENT_MEDIA_INFO_H__
21 #include <media_content_type.h>
27 #endif /* __cplusplus */
31 * @brief This file contains the media info function and related functions to proceed with it. \n
32 * You can use the functions to insert, delete, count and get list of content files from media database. \n
33 * You can get properties of content file such as size, mime_type, modified_time etc. And you can set properties such as favorite etc. \n
34 * And you can get bookmark, face, tag info related the content file.
39 * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
44 * @brief Inserts the content file into the media database.
45 * @details In general, you can use this function to insert content files into the media database. \n
46 * You can use media_content_scan_file()/media_content_scan_folder() function instead of this function. \n
47 * If media information exists in the media database, this function returns information stored in the database.\n
48 * Since 5.5, if media information already exists in the media database,
49 * this function returns the updated latest information. (Media database will be updated if necessary).
51 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
54 * @privilege %http://tizen.org/privilege/content.write \n
55 * %http://tizen.org/privilege/mediastorage \n
56 * %http://tizen.org/privilege/externalstorage
58 * @remarks The @a info should be released using media_info_destroy(). \n
59 * You must add the privilege %http://tizen.org/privilege/content.write. You need to add more privileges depending on your choice of contents path. \n
60 * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
61 * If you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
62 * If you want to access storages of both types, you must add all privileges. \n
63 * Since 4.0, this function does not accept symbolic links. \n
64 * @remarks Since 4.0, this function is related to the following feature:\n
65 * %http://tizen.org/feature/content.scanning.others\n
66 * If this feature is not supported on the device, #MEDIA_CONTENT_TYPE_OTHERS type files are not scanned.
68 * @param[in] path The path of the content file to add
69 * @param[out] info The handle of the inserted content file
71 * @return @c 0 on success,
72 * otherwise a negative error value
74 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
75 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
76 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
77 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
78 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
79 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
80 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
81 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
82 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
84 * @pre This function requires opened connection to content service by media_content_connect().
86 * @see media_content_connect()
87 * @see media_content_scan_file()
88 * @see media_content_scan_folder()
90 int media_info_insert_to_db(const char *path, media_info_h *info);
93 * @brief Inserts content files into the media database, asynchronously.
94 * @details This function can insert multiple content files into the media database.
96 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
99 * @privilege %http://tizen.org/privilege/content.write \n
100 * %http://tizen.org/privilege/mediastorage \n
101 * %http://tizen.org/privilege/externalstorage
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 function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
105 * Or if you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
106 * If you can access both storage, you must add all privilege. \n
107 * Since 4.0, This function does not allow a symbolic link. \n
108 * @remarks Since 4.0, this function is related to the following feature:\n
109 * %http://tizen.org/feature/content.scanning.others\n
110 * If this feature is not supported on the device, MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
112 * @param[in] path_array The path array of the content files to add
113 * @param[in] array_length The length of the array
114 * @param[in] callback The callback function to be invoked when media items inserted completely
115 * @param[in] user_data The user data to be passed to the callback function
117 * @return @c 0 on success,
118 * otherwise a negative error value
120 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
121 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
122 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
123 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
124 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
125 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
126 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
127 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
128 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
130 * @pre This function requires opened connection to content service by media_content_connect().
132 * @see media_content_connect()
133 * @see media_insert_completed_cb()
135 int media_info_insert_batch_to_db(const char **path_array, unsigned int array_length, media_insert_completed_cb callback, void *user_data);
138 * @brief Destroys media info.
139 * @details The function frees all resources related to the media info handle. This handle
140 * can no longer be used to perform any operations. New media info handle has to
141 * be created before the next usage.
143 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
145 * @param[in] media The handle to the media info
147 * @return @c 0 on success,
148 * otherwise a negative error value
150 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
151 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
153 * @pre Get copy of media_info handle by calling media_info_clone().
155 * @see media_info_clone()
157 int media_info_destroy(media_info_h media);
160 * @brief Clones the media info handle.
162 * @details This function copies the media info handle from a source to the destination.
163 * To use this handle outside of these foreach functions, use this function.
165 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
167 * @remarks The @a dst should be released using media_info_destroy().
169 * @param[out] dst The destination handle to the media info
170 * @param[in] src The source handle to the media info
172 * @return @c 0 on success,
173 * otherwise a negative error value
175 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
176 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
177 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
179 * @see media_info_destroy()
180 * @see media_album_foreach_media_from_db()
181 * @see media_playlist_foreach_media_from_db()
182 * @see media_group_foreach_media_from_db()
183 * @see media_tag_foreach_media_from_db()
184 * @see media_info_foreach_media_from_db()
185 * @see media_info_insert_to_db()
186 * @see media_folder_foreach_media_from_db()
188 int media_info_clone(media_info_h *dst, media_info_h src);
191 * @brief Gets the count of media info for the passed @a filter from the media database.
192 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
194 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
197 * @param[in] filter The handle to the media filter
198 * @param[out] media_count The count of media
200 * @return @c 0 on success,
201 * otherwise a negative error value
203 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
204 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
205 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
206 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
208 * @pre This function requires opened connection to content service by media_content_connect().
210 * @see media_content_connect()
211 * @see media_filter_create()
213 int media_info_get_media_count_from_db(filter_h filter, int *media_count);
216 * @brief Iterates through media info from the media database.
217 * @details This function gets all media info handles meeting the given @a filter.
218 * The @a callback function will be invoked for every retrieved media info.
219 * If @c NULL is passed to the @a filter, then no filtering is applied.
221 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
223 * @remarks Do not call updating DB function like media_info_update_to_db() in your callback function,
224 * your callback function is invoked as inline function.
225 * So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB.
226 * We do not recommend you call updating DB function in callback of foreach function.
228 * @param[in] filter The handle to the media filter
229 * @param[in] callback The callback function to be invoked
230 * @param[in] user_data The user data to be passed to the callback function
232 * @return @c 0 on success,
233 * otherwise a negative error value
235 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
236 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
237 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
238 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
239 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
241 * @pre This function requires opened connection to content service by media_content_connect().
242 * @post This function invokes media_info_cb().
244 * @see media_content_connect()
245 * @see #media_info_cb
246 * @see media_filter_create()
248 int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data);
251 * @brief Gets the count of media tags for the passed @a filter in the given @a media_id from the media database.
252 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
254 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256 * @param[in] media_id The media ID
257 * @param[in] filter The handle to the media filter
258 * @param[out] tag_count The count of the media tag
260 * @return @c 0 on success,
261 * otherwise a negative error value
263 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
264 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
265 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
266 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
268 * @pre This function requires opened connection to content service by media_content_connect().
270 * @see media_content_connect()
271 * @see media_filter_create()
273 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count);
276 * @brief Iterates through the media tag in the given media info from the media database.
277 * @details This function gets all the media tags associated with the given @a media_id and calls @a callback for every retrieved media tag. \n
278 * If @c NULL is passed to the @a filter, then no filtering is applied.
280 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
282 * @param[in] media_id The media ID
283 * @param[in] filter The handle to the media filter
284 * @param[in] callback The callback function to be invoked
285 * @param[in] user_data The user data to be passed to the callback function
287 * @return @c 0 on success,
288 * otherwise a negative error value
290 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
291 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
292 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
293 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
294 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
296 * @pre This function requires opened connection to content service by media_content_connect().
297 * @post This function invokes media_tag_cb().
299 * @see media_content_connect()
301 * @see media_filter_create()
303 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
306 * @brief Gets the number of bookmarks for the passed @a filter in the given media ID from the media database.
307 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
309 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
311 * @param[in] media_id The media ID
312 * @param[in] filter The handle to the media filter
313 * @param[out] bookmark_count The count of the media tag
315 * @return @c 0 on success,
316 * otherwise a negative error value
318 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
319 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
320 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
321 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
323 * @pre This function requires opened connection to content service by media_content_connect().
325 * @see media_content_connect()
326 * @see media_filter_create()
328 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count);
331 * @brief Iterates through the media bookmark in the given media info from the media database.
332 * @details This function gets all media bookmarks associated with the given media and calls @a callback for every retrieved media bookmark.
333 * If @c NULL is passed to the @a filter, then no filtering is applied.
335 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
337 * @param[in] media_id The media ID
338 * @param[in] filter The handle to the media filter
339 * @param[in] callback The callback function to be invoked
340 * @param[in] user_data The user data to be passed to the callback function
342 * @return @c 0 on success,
343 * otherwise a negative error value
345 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
346 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
347 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
348 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
349 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
351 * @pre This function requires opened connection to content service by media_content_connect().
352 * @post This function invokes media_bookmark_cb().
354 * @see media_content_connect()
355 * @see media_bookmark_cb()
356 * @see media_filter_create()
358 int media_info_foreach_bookmark_from_db(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
361 * @brief Gets the number of face for the passed @a media_id from the media database.
362 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
366 * @param[in] media_id The media ID
367 * @param[in] filter The handle to the media filter
368 * @param[out] face_count The count of media face
370 * @return 0 on success, otherwise a negative error value.
372 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
373 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
374 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
376 * @pre This function requires opened connection to content service by media_content_connect().
377 * @see media_content_connect()
378 * @see media_filter_create()
381 int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count);
384 * @brief Iterates through the media files with optional @a filter in the given @a media_id from the media database.
385 * @details This function gets all media face info associated with the given media id and
386 * meeting desired filter option and calls @a callback for
387 * every retrieved media face info. If NULL is passed to the @a filter, no filtering is applied.
391 * @param[in] media_id The media ID
392 * @param[in] filter The handle to the media filter
393 * @param[in] callback The callback function to invoke
394 * @param[in] user_data The user data to be passed to the callback function
396 * @return 0 on success, otherwise a negative error value.
398 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
399 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
400 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
402 * @pre This function requires opened connection to content service by media_content_connect().
403 * @see media_content_connect()
404 * @see media_filter_create()
407 int media_info_foreach_face_from_db(const char *media_id, filter_h filter, media_face_cb callback, void *user_data);
410 * @brief Gets the image metadata handle for a given media info.
411 * @details This function returns an image metadata handle retrieved from the media info.
413 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
415 * @remarks The @a image should be released using image_meta_destroy().
417 * @param[in] media The handle to the media info
418 * @param[out] image The handle to the image metadata
420 * @return @c 0 on success,
421 * otherwise a negative error value
423 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
424 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
425 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
427 * @see image_meta_destroy()
429 int media_info_get_image(media_info_h media, image_meta_h *image);
432 * @brief Gets a video metadata handle for a given media info.
433 * @details This function returns a video metadata handle retrieved from the media info handle.
435 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
437 * @remarks The @a video should be released using video_meta_destroy().
439 * @param[in] media The handle to the media info
440 * @param[out] video The handle to the video metadata
442 * @return @c 0 on success,
443 * otherwise a negative error value
445 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
446 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
447 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
449 * @see video_meta_destroy()
451 int media_info_get_video(media_info_h media, video_meta_h *video);
454 * @brief Gets an audio metadata handle for a given media info.
455 * @details This function returns an audio metadata handle retrieved from the media info handle.
457 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
459 * @remarks The @a audio should be released using audio_meta_destroy().
461 * @param[in] media The handle to the media info
462 * @param[out] audio The handle to the audio metadata
464 * @return @c 0 on success,
465 * otherwise a negative error value
467 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
468 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
469 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
471 * @see audio_meta_destroy()
473 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
476 * @brief Gets a book metadata handle for a given media info.
477 * @details This function returns a book metadata handle retrieved from the media info handle. \n
478 * The title and description information of the book can be obtained from @a media.
482 * @remarks The @a book should be released using book_meta_destroy().
484 * @param[in] media The handle to the media info
485 * @param[out] book The handle to the book metadata
487 * @return @c 0 on success,
488 * otherwise a negative error value
490 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
491 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
493 * @see media_info_get_title()
494 * @see media_info_get_description()
495 * @see book_meta_destroy()
497 int media_info_get_book(media_info_h media, book_meta_h *book);
500 * @brief Gets the media ID.
501 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
502 * @remarks The @a media_id should be released using free().
504 * @param[in] media The handle to the media info
505 * @param[out] media_id The media ID
507 * @return @c 0 on success,
508 * otherwise a negative error value
510 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
511 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
512 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
514 int media_info_get_media_id(media_info_h media, char **media_id);
517 * @brief Gets the full path of the content file.
518 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
520 * @remarks The @a path should be released using free().
522 * @param[in] media The handle to the media info
523 * @param[out] path The full path of the content file
525 * @return @c 0 on success,
526 * otherwise a negative error value
528 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
529 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
530 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
533 int media_info_get_file_path(media_info_h media, char **path);
536 * @brief Gets the file name including the extension of the content file.
537 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
539 * @remarks The @a name should be released using free().
541 * @param[in] media The handle to the media info
542 * @param[out] name The file name including the extension of the content file
544 * @return @c 0 on success,
545 * otherwise a negative error value
547 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
548 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
549 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
551 int media_info_get_display_name(media_info_h media, char **name);
554 * @brief Gets the content type of the content file.
555 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
557 * @param[in] media The handle to the media info
558 * @param[out] type The content type of the content file (#media_content_type_e)
560 * @return @c 0 on success,
561 * otherwise a negative error value
563 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
564 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
566 * @see #media_content_type_e
568 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
571 * @brief Gets the MIME type of the content file.
572 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
574 * @remarks The @a mime_type should be released using free().
576 * @param[in] media The handle to the media info
577 * @param[out] mime_type The MIME type of the content file
579 * @return @c 0 on success,
580 * otherwise a negative error value
582 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
583 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
584 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
586 int media_info_get_mime_type(media_info_h media, char **mime_type);
589 * @brief Gets the content file size.
590 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
592 * @param[in] media The handle to the media info
593 * @param[out] size The content file size
595 * @return @c 0 on success,
596 * otherwise a negative error value
598 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
599 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
601 int media_info_get_size(media_info_h media, unsigned long long *size);
604 * @brief Gets the added time of the content file.
605 * @details The added time refers to the time that content file was first added to media database.
606 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
608 * @param[in] media The handle to the media info
609 * @param[out] added_time The added time to the media database
611 * @return @c 0 on success,
612 * otherwise a negative error value
614 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
615 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
617 int media_info_get_added_time(media_info_h media, time_t *added_time);
620 * @brief Gets the modified time of the content file.
621 * @details The modified time refers to the last modification time provided by the file system.
622 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
624 * @param[in] media The handle to the media info
625 * @param[out] time The last modification time of the content file
627 * @return @c 0 on success,
628 * otherwise a negative error value
630 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
631 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
633 int media_info_get_modified_time(media_info_h media, time_t *time);
636 * @brief Gets the timeline of content file.
637 * @details If the content file has the creation time information (like Content recorded date or Image creation date), that value is timeline. \n
638 * Otherwise, timeline value is the same as modified time.
639 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
641 * @param[in] media The handle to the media info
642 * @param[out] time The timeline of content file
644 * @return @c 0 on success,
645 * otherwise a negative error value
647 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
648 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
650 int media_info_get_timeline(media_info_h media, time_t *time);
653 * @brief Gets the thumbnail path of content file.
654 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
656 * @remarks The @a path should be released using free(). \n
657 * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. \n
658 * To create a thumbnail, you should use media_info_generate_thumbnail() function. \n
659 * This function returns an empty string if media_info_generate_thumbnail() has failed to create a thumbnail for the given media.
661 * @param[in] media The handle to the media info
662 * @param[out] path The thumbnail path
664 * @return @c 0 on success,
665 * otherwise a negative error value
667 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
668 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
669 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
671 int media_info_get_thumbnail_path(media_info_h media, char **path);
674 * @brief Gets the description of content file.
675 * @details If the value is an empty string, the method returns "Unknown". \n
676 * Since 3.0, if the media info has no description, the method returns empty string.
677 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
679 * @remarks The @a description should be released using free().
681 * @param[in] media The handle to the media info
682 * @param[out] description The description of the content file
684 * @return @c 0 on success,
685 * otherwise a negative error value
687 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
688 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
689 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
691 int media_info_get_description(media_info_h media, char **description);
694 * @brief Gets the longitude of content file.
695 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
697 * @param[in] media The handle to the media info
698 * @param[out] longitude The longitude of the content file
700 * @return @c 0 on success,
701 * otherwise a negative error value
703 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
704 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
706 int media_info_get_longitude(media_info_h media, double *longitude);
709 * @brief Gets the latitude of content file.
710 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
712 * @param[in] media The handle to the media info
713 * @param[out] latitude The latitude of the content file
715 * @return @c 0 on success,
716 * otherwise a negative error value
718 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
719 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
722 int media_info_get_latitude(media_info_h media, double* latitude);
725 * @brief Gets the altitude of content file.
726 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
728 * @param[in] media The handle to the media info
729 * @param[out] altitude The altitude of the content file
731 * @return @c 0 on success,
732 * otherwise a negative error value
734 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
735 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
737 int media_info_get_altitude(media_info_h media, double* altitude);
740 * @brief Gets the rating of content file.
741 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
743 * @param[in] media The handle to the media info
744 * @param[out] rating The rating of the content file
746 * @return @c 0 on success,
747 * otherwise a negative error value
749 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
750 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
752 int media_info_get_rating(media_info_h media, int *rating);
755 * @brief Gets the favorite status of content file which User set.
756 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
758 * @param[in] media The handle to the media info
759 * @param[out] favorite @c true if content file is set as favorite,
760 * otherwise @c false if content file is not set as favorite
762 * @return @c 0 on success,
763 * otherwise a negative error value
765 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
766 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
768 * @see media_info_set_favorite()
770 int media_info_get_favorite(media_info_h media, bool* favorite);
773 * @brief Gets the title of content file.
774 * @details If the content file does not have a title, this method returns the filename without the extension.
776 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
778 * @remarks The @a title should be released using free().
780 * @param[in] media The handle to the media info
781 * @param[out] title The title of the content file
783 * @return @c 0 on success,
784 * otherwise a negative error value
786 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
787 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
788 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
790 int media_info_get_title(media_info_h media, char **title);
793 * @brief Checks whether the media is protected via DRM.
794 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
796 * @param[in] media The handle to the media info
797 * @param[out] is_drm @c true if media is DRM media,
798 * otherwise @c false if media is not DRM media
800 * @return @c 0 on success,
801 * otherwise a negative error value
803 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
804 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
806 int media_info_is_drm(media_info_h media, bool *is_drm);
809 * @brief Checks whether the content file is 360 content.
812 * @param[in] media The handle to the media info
813 * @param[out] is_360 @c true if media is 360 content,
814 * otherwise @c false if media is not 360 content
816 * @return @c 0 on success,
817 * otherwise a negative error value
819 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
820 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
822 int media_info_is_360_content(media_info_h media, bool *is_360);
825 * @brief Gets the media info from the media database.
827 * @details This function creates a new media handle from the media database by the given @a media_id.
828 * Media info will be created and filled with information.
830 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
832 * @remarks The @a media should be released using media_info_destroy().
834 * @param[in] media_id The media ID
835 * @param[out] media The handle to the media info
837 * @return @c 0 on success,
838 * otherwise a negative error value
840 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
841 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
842 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
843 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
844 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
846 * @pre This function requires opened connection to content service by media_content_connect().
848 * @see media_content_connect()
849 * @see media_info_destroy()
851 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
854 * @brief Gets the media info from the media database using path.
856 * @details This function creates a new media handle filled with information from the database by the given @a media_path.
860 * @remarks The @a media should be released using media_info_destroy().\n
861 * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
862 * If you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
863 * If you want to access storages of both types, you must add all privileges. \n
865 * @param[in] media_path The media path
866 * @param[out] media The handle to the media info
868 * @return @c 0 on success,
869 * otherwise a negative error value
871 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
872 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
873 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
874 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
875 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
876 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
878 * @pre This function requires opened connection to content service by media_content_connect().
880 * @see media_content_connect()
881 * @see media_info_destroy()
883 int media_info_get_media_from_db_by_path(const char *media_path, media_info_h *media);
886 * @brief Sets the favorite of media info.
887 * @details This function can mark favorite of the media. If set to @c true, this function record the time of the change moment. \n
888 * So, If you use it in order parameter, you can sort the order of the time was a favorite. \n
889 * Or, if you use it in condition parameter, you can get the result of the favorite media.
891 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
893 * @param[in] media The handle to the media info
894 * @param[in] favorite Set @c true to set the media info as favorite,
895 * otherwise set @c false to not set the media info as favorite
897 * @return @c 0 on success,
898 * otherwise a negative error value
900 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
901 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
903 int media_info_set_favorite(media_info_h media, bool favorite);
906 * @brief Updates the media info to the media database.
908 * @details The function updates the given media info in the media database.
910 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
912 * @privilege %http://tizen.org/privilege/content.write
914 * @remarks The function should be called after any change in media, to be updated to the media
915 * database. For example, after using media_info_set_favorite()
916 * for setting the name of the media, the media_info_update_to_db() function should be called so as to update
917 * the given media info attributes in the media database.
919 * @param[in] media The handle to the media info
921 * @return @c 0 on success,
922 * otherwise a negative error value
924 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
925 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
926 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
927 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
928 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
929 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
930 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
931 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
933 * @pre This function requires opened connection to content service by media_content_connect().
935 * @see media_content_connect()
936 * @see media_info_set_favorite()
938 int media_info_update_to_db(media_info_h media);
941 * @brief Moves the media info to the given destination path in the media database.
942 * @details After moving or renaming a file in the filesystem, call this function to update the database. \n
943 * If the source path and destination path are the same, then this function does nothing.
944 * If you want to refresh media information, you should use media_content_scan_file() function.
946 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
949 * @privilege %http://tizen.org/privilege/content.write \n
950 * %http://tizen.org/privilege/mediastorage \n
951 * %http://tizen.org/privilege/externalstorage
953 * @remarks You must add privilege %http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
954 * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
955 * Or if you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
956 * If you can access both storage, you should add all privilege. \n
957 * Since 4.0, this function does not allow symbolic links. \n
958 * This function does not support USB storage before 5.0. Since 5.0, USB storage is supported. \n
959 * Since 5.0, the thumbnail is removed if it exists.
961 * @param[in] media The handle to the media info
962 * @param[in] dst_path The path of destination
964 * @return @c 0 on success,
965 * otherwise a negative error value
967 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
968 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter (Especially, if the request is duplicated, this error returns.)
969 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
970 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
971 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
972 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
973 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
974 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
976 * @pre This function requires opened connection to content service by media_content_connect().
978 * @see media_content_connect()
979 * @see media_content_scan_folder()
980 * @see media_info_generate_thumbnail()
982 int media_info_move_to_db(media_info_h media, const char* dst_path);
985 * @brief Generates a thumbnail file for the given media, synchronously.
990 * @privilege %http://tizen.org/privilege/content.write
992 * @remarks %http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
993 * %http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
994 * Items in external storage are not supported, with the exception of MMC.
996 * @param[in] media The handle to the media info
998 * @return @c 0 on success,
999 * otherwise a negative error value
1001 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1002 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1003 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1004 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1005 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1006 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1007 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1008 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1010 * @pre This function requires opened connection to content service by media_content_connect().
1012 * @see media_content_connect()
1013 * @see media_info_get_thumbnail_path()
1015 int media_info_generate_thumbnail(media_info_h media);
1018 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1019 * @brief Starts face detection for the given image, asynchronously.
1020 * @details This function detects faces for given image item and calls the given callback function when the detection is completed. \n
1021 * The given callback function is called when the detection is completed. \n
1022 * To obtain the detected faces, call the media_info_foreach_face_from_db() function. \n
1023 * Supported image formats are jpg, png, and bmp.
1028 * @privilege %http://tizen.org/privilege/content.write \n
1029 * %http://tizen.org/privilege/mediastorage \n
1030 * %http://tizen.org/privilege/externalstorage
1032 * @remarks If you want to destroy the media handle before the callback invoked, you must cancel the face detection request using media_info_cancel_face_detection(). \n
1033 * If the face detection fails, the @a face_count argument in media_face_detection_completed_cb() will be set to 0. \n
1034 * The face detection of media items in external storage except MMC is not supported. \n
1035 * Since 5.5, if the format of media data is unsupported, this function returns an error and the callback will not be invoked.
1037 * @param[in] media The handle to the media info
1038 * @param[in] callback The callback function to be invoked when detection is completed
1039 * @param[in] user_data The user data to be passed to the callback function
1041 * @return @c 0 on success,
1042 * otherwise a negative error value
1044 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1045 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1046 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1047 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1048 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1049 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1050 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1051 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1052 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
1054 * @pre This function requires opened connection to content service by media_content_connect().
1056 * @see media_content_connect()
1057 * @see media_info_cancel_face_detection()
1059 int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data);
1062 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1063 * @brief Cancels face detection of image for the given media.
1064 * @details This function cancels face detection for given media item. \n
1065 * If you cancel face detection request before callback is invoked, the callback registered by media_info_start_face_detection() function will not be invoked.
1070 * @privilege %http://tizen.org/privilege/content.write
1072 * @remarks If face detection is already done when you request the cancellation, this function returns #MEDIA_CONTENT_ERROR_INVALID_OPERATION
1074 * @param[in] media The handle to the media info
1076 * @return @c 0 on success,
1077 * otherwise a negative error value
1079 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1080 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1081 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1082 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1084 * @pre This function requires opened connection to content service by media_content_connect().
1086 * @see media_content_connect()
1087 * @see media_info_start_face_detection()
1089 int media_info_cancel_face_detection(media_info_h media);
1097 #endif /* __cplusplus */
1099 #endif /* __TIZEN_CONTENT_MEDIA_INFO_H__ */