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 * @deprecated Deprecated since 8.0.
362 * @brief Gets the number of face for the passed @a media_id from the media database.
363 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
367 * @param[in] media_id The media ID
368 * @param[in] filter The handle to the media filter
369 * @param[out] face_count The count of media face
371 * @return 0 on success, otherwise a negative error value.
373 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
374 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
375 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
377 * @pre This function requires opened connection to content service by media_content_connect().
378 * @see media_content_connect()
379 * @see media_filter_create()
382 int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count) TIZEN_DEPRECATED_API;
385 * @deprecated Deprecated since 8.0.
386 * @brief Iterates through the media files with optional @a filter in the given @a media_id from the media database.
387 * @details This function gets all media face info associated with the given media id and
388 * meeting desired filter option and calls @a callback for
389 * every retrieved media face info. If NULL is passed to the @a filter, no filtering is applied.
393 * @param[in] media_id The media ID
394 * @param[in] filter The handle to the media filter
395 * @param[in] callback The callback function to invoke
396 * @param[in] user_data The user data to be passed to the callback function
398 * @return 0 on success, otherwise a negative error value.
400 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
401 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
402 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
404 * @pre This function requires opened connection to content service by media_content_connect().
405 * @see media_content_connect()
406 * @see media_filter_create()
409 int media_info_foreach_face_from_db(const char *media_id, filter_h filter, media_face_cb callback, void *user_data) TIZEN_DEPRECATED_API;
412 * @brief Gets the image metadata handle for a given media info.
413 * @details This function returns an image metadata handle retrieved from the media info.
415 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
417 * @remarks The @a image should be released using image_meta_destroy().
419 * @param[in] media The handle to the media info
420 * @param[out] image The handle to the image metadata
422 * @return @c 0 on success,
423 * otherwise a negative error value
425 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
426 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
427 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
429 * @see image_meta_destroy()
431 int media_info_get_image(media_info_h media, image_meta_h *image);
434 * @brief Gets a video metadata handle for a given media info.
435 * @details This function returns a video metadata handle retrieved from the media info handle.
437 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
439 * @remarks The @a video should be released using video_meta_destroy().
441 * @param[in] media The handle to the media info
442 * @param[out] video The handle to the video metadata
444 * @return @c 0 on success,
445 * otherwise a negative error value
447 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
448 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
449 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
451 * @see video_meta_destroy()
453 int media_info_get_video(media_info_h media, video_meta_h *video);
456 * @brief Gets an audio metadata handle for a given media info.
457 * @details This function returns an audio metadata handle retrieved from the media info handle.
459 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
461 * @remarks The @a audio should be released using audio_meta_destroy().
463 * @param[in] media The handle to the media info
464 * @param[out] audio The handle to the audio metadata
466 * @return @c 0 on success,
467 * otherwise a negative error value
469 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
470 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
471 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
473 * @see audio_meta_destroy()
475 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
478 * @brief Gets a book metadata handle for a given media info.
479 * @details This function returns a book metadata handle retrieved from the media info handle. \n
480 * The title and description information of the book can be obtained from @a media.
484 * @remarks The @a book should be released using book_meta_destroy().
486 * @param[in] media The handle to the media info
487 * @param[out] book The handle to the book metadata
489 * @return @c 0 on success,
490 * otherwise a negative error value
492 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
493 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
495 * @see media_info_get_title()
496 * @see media_info_get_description()
497 * @see book_meta_destroy()
499 int media_info_get_book(media_info_h media, book_meta_h *book);
502 * @brief Gets the media ID.
503 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
504 * @remarks The @a media_id should be released using free().
506 * @param[in] media The handle to the media info
507 * @param[out] media_id The media ID
509 * @return @c 0 on success,
510 * otherwise a negative error value
512 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
513 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
514 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
516 int media_info_get_media_id(media_info_h media, char **media_id);
519 * @brief Gets the full path of the content file.
520 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
522 * @remarks The @a path should be released using free().
524 * @param[in] media The handle to the media info
525 * @param[out] path The full path of the content file
527 * @return @c 0 on success,
528 * otherwise a negative error value
530 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
531 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
532 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
535 int media_info_get_file_path(media_info_h media, char **path);
538 * @brief Gets the file name including the extension of the content file.
539 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
541 * @remarks The @a name should be released using free().
543 * @param[in] media The handle to the media info
544 * @param[out] name The file name including the extension of the content file
546 * @return @c 0 on success,
547 * otherwise a negative error value
549 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
550 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
551 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
553 int media_info_get_display_name(media_info_h media, char **name);
556 * @brief Gets the content type of the content file.
557 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
559 * @param[in] media The handle to the media info
560 * @param[out] type The content type of the content file (#media_content_type_e)
562 * @return @c 0 on success,
563 * otherwise a negative error value
565 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
566 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
568 * @see #media_content_type_e
570 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
573 * @brief Gets the MIME type of the content file.
574 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
576 * @remarks The @a mime_type should be released using free().
578 * @param[in] media The handle to the media info
579 * @param[out] mime_type The MIME type of the content file
581 * @return @c 0 on success,
582 * otherwise a negative error value
584 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
585 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
586 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
588 int media_info_get_mime_type(media_info_h media, char **mime_type);
591 * @brief Gets the content file size.
592 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
594 * @param[in] media The handle to the media info
595 * @param[out] size The content file size
597 * @return @c 0 on success,
598 * otherwise a negative error value
600 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
601 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
603 int media_info_get_size(media_info_h media, unsigned long long *size);
606 * @brief Gets the added time of the content file.
607 * @details The added time refers to the time that content file was first added to media database.
608 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
610 * @param[in] media The handle to the media info
611 * @param[out] added_time The added time to the media database
613 * @return @c 0 on success,
614 * otherwise a negative error value
616 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
617 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
619 int media_info_get_added_time(media_info_h media, time_t *added_time);
622 * @brief Gets the modified time of the content file.
623 * @details The modified time refers to the last modification time provided by the file system.
624 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
626 * @param[in] media The handle to the media info
627 * @param[out] time The last modification time of the content file
629 * @return @c 0 on success,
630 * otherwise a negative error value
632 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
633 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
635 int media_info_get_modified_time(media_info_h media, time_t *time);
638 * @brief Gets the timeline of content file.
639 * @details If the content file has the creation time information (like Content recorded date or Image creation date), that value is timeline. \n
640 * Otherwise, timeline value is the same as modified time.
641 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
643 * @param[in] media The handle to the media info
644 * @param[out] time The timeline of content file
646 * @return @c 0 on success,
647 * otherwise a negative error value
649 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
650 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
652 int media_info_get_timeline(media_info_h media, time_t *time);
655 * @brief Gets the thumbnail path of content file.
656 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
658 * @remarks The @a path should be released using free(). \n
659 * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. \n
660 * To create a thumbnail, you should use media_info_generate_thumbnail() function. \n
661 * This function returns an empty string if media_info_generate_thumbnail() has failed to create a thumbnail for the given media.
663 * @param[in] media The handle to the media info
664 * @param[out] path The thumbnail path
666 * @return @c 0 on success,
667 * otherwise a negative error value
669 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
670 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
671 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
673 int media_info_get_thumbnail_path(media_info_h media, char **path);
676 * @brief Gets the description of content file.
677 * @details If the value is an empty string, the method returns "Unknown". \n
678 * Since 3.0, if the media info has no description, the method returns empty string.
679 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
681 * @remarks The @a description should be released using free().
683 * @param[in] media The handle to the media info
684 * @param[out] description The description of the content file
686 * @return @c 0 on success,
687 * otherwise a negative error value
689 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
690 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
691 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
693 int media_info_get_description(media_info_h media, char **description);
696 * @brief Gets the longitude of content file.
697 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
699 * @param[in] media The handle to the media info
700 * @param[out] longitude The longitude of the content file
702 * @return @c 0 on success,
703 * otherwise a negative error value
705 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
706 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
708 int media_info_get_longitude(media_info_h media, double *longitude);
711 * @brief Gets the latitude of content file.
712 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
714 * @param[in] media The handle to the media info
715 * @param[out] latitude The latitude of the content file
717 * @return @c 0 on success,
718 * otherwise a negative error value
720 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
721 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
724 int media_info_get_latitude(media_info_h media, double* latitude);
727 * @brief Gets the altitude of content file.
728 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
730 * @param[in] media The handle to the media info
731 * @param[out] altitude The altitude of the content file
733 * @return @c 0 on success,
734 * otherwise a negative error value
736 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
737 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
739 int media_info_get_altitude(media_info_h media, double* altitude);
742 * @brief Gets the rating of content file.
743 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
745 * @param[in] media The handle to the media info
746 * @param[out] rating The rating of the content file
748 * @return @c 0 on success,
749 * otherwise a negative error value
751 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
752 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
754 int media_info_get_rating(media_info_h media, int *rating);
757 * @brief Gets the favorite status of content file which User set.
758 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
760 * @param[in] media The handle to the media info
761 * @param[out] favorite @c true if content file is set as favorite,
762 * otherwise @c false if content file is not set as favorite
764 * @return @c 0 on success,
765 * otherwise a negative error value
767 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
768 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
770 * @see media_info_set_favorite()
772 int media_info_get_favorite(media_info_h media, bool* favorite);
775 * @brief Gets the title of content file.
776 * @details If the content file does not have a title, this method returns the filename without the extension.
778 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
780 * @remarks The @a title should be released using free().
782 * @param[in] media The handle to the media info
783 * @param[out] title The title of the content file
785 * @return @c 0 on success,
786 * otherwise a negative error value
788 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
789 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
790 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
792 int media_info_get_title(media_info_h media, char **title);
795 * @brief Checks whether the media is protected via DRM.
796 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
798 * @param[in] media The handle to the media info
799 * @param[out] is_drm @c true if media is DRM media,
800 * otherwise @c false if media is not DRM media
802 * @return @c 0 on success,
803 * otherwise a negative error value
805 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
806 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
808 int media_info_is_drm(media_info_h media, bool *is_drm);
811 * @brief Checks whether the content file is 360 content.
814 * @param[in] media The handle to the media info
815 * @param[out] is_360 @c true if media is 360 content,
816 * otherwise @c false if media is not 360 content
818 * @return @c 0 on success,
819 * otherwise a negative error value
821 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
822 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
824 int media_info_is_360_content(media_info_h media, bool *is_360);
827 * @brief Gets the media info from the media database.
829 * @details This function creates a new media handle from the media database by the given @a media_id.
830 * Media info will be created and filled with information.
832 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
834 * @remarks The @a media should be released using media_info_destroy().
836 * @param[in] media_id The media ID
837 * @param[out] media The handle to the media info
839 * @return @c 0 on success,
840 * otherwise a negative error value
842 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
843 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
844 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
845 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
846 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
848 * @pre This function requires opened connection to content service by media_content_connect().
850 * @see media_content_connect()
851 * @see media_info_destroy()
853 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
856 * @brief Gets the media info from the media database using path.
858 * @details This function creates a new media handle filled with information from the database by the given @a media_path.
862 * @remarks The @a media should be released using media_info_destroy().\n
863 * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
864 * If you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
865 * If you want to access storages of both types, you must add all privileges. \n
867 * @param[in] media_path The media path
868 * @param[out] media The handle to the media info
870 * @return @c 0 on success,
871 * otherwise a negative error value
873 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
874 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
875 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
876 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
877 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
878 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
880 * @pre This function requires opened connection to content service by media_content_connect().
882 * @see media_content_connect()
883 * @see media_info_destroy()
885 int media_info_get_media_from_db_by_path(const char *media_path, media_info_h *media);
888 * @brief Sets the favorite of media info.
889 * @details This function can mark favorite of the media. If set to @c true, this function record the time of the change moment. \n
890 * So, If you use it in order parameter, you can sort the order of the time was a favorite. \n
891 * Or, if you use it in condition parameter, you can get the result of the favorite media.
893 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
895 * @param[in] media The handle to the media info
896 * @param[in] favorite Set @c true to set the media info as favorite,
897 * otherwise set @c false to not set the media info as favorite
899 * @return @c 0 on success,
900 * otherwise a negative error value
902 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
903 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
905 int media_info_set_favorite(media_info_h media, bool favorite);
908 * @brief Updates the media info to the media database.
910 * @details The function updates the given media info in the media database.
912 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
914 * @privilege %http://tizen.org/privilege/content.write
916 * @remarks The function should be called after any change in media, to be updated to the media
917 * database. For example, after using media_info_set_favorite()
918 * for setting the name of the media, the media_info_update_to_db() function should be called so as to update
919 * the given media info attributes in the media database.
921 * @param[in] media The handle to the media info
923 * @return @c 0 on success,
924 * otherwise a negative error value
926 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
927 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
928 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
929 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
930 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
931 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
932 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
933 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
935 * @pre This function requires opened connection to content service by media_content_connect().
937 * @see media_content_connect()
938 * @see media_info_set_favorite()
940 int media_info_update_to_db(media_info_h media);
943 * @brief Moves the media info to the given destination path in the media database.
944 * @details After moving or renaming a file in the filesystem, call this function to update the database. \n
945 * If the source path and destination path are the same, then this function does nothing.
946 * If you want to refresh media information, you should use media_content_scan_file() function.
948 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
951 * @privilege %http://tizen.org/privilege/content.write \n
952 * %http://tizen.org/privilege/mediastorage \n
953 * %http://tizen.org/privilege/externalstorage
955 * @remarks You must add privilege %http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
956 * If you want to access only internal storage by using this function, you should add privilege %http://tizen.org/privilege/mediastorage. \n
957 * Or if you want to access only external storage by using this function, you should add privilege %http://tizen.org/privilege/externalstorage. \n
958 * If you can access both storage, you should add all privilege. \n
959 * Since 4.0, this function does not allow symbolic links. \n
960 * This function does not support USB storage before 5.0. Since 5.0, USB storage is supported. \n
961 * Since 5.0, the thumbnail is removed if it exists.
963 * @param[in] media The handle to the media info
964 * @param[in] dst_path The path of destination
966 * @return @c 0 on success,
967 * otherwise a negative error value
969 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
970 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter (Especially, if the request is duplicated, this error returns.)
971 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
972 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
973 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
974 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
975 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
976 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
978 * @pre This function requires opened connection to content service by media_content_connect().
980 * @see media_content_connect()
981 * @see media_content_scan_folder()
982 * @see media_info_generate_thumbnail()
984 int media_info_move_to_db(media_info_h media, const char* dst_path);
987 * @brief Generates a thumbnail file for the given media, synchronously.
992 * @privilege %http://tizen.org/privilege/content.write
994 * @remarks %http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
995 * %http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
996 * Items in external storage are not supported, with the exception of MMC.
998 * @param[in] media The handle to the media info
1000 * @return @c 0 on success,
1001 * otherwise a negative error value
1003 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1004 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1005 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1006 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1007 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1008 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1009 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1010 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1012 * @pre This function requires opened connection to content service by media_content_connect().
1014 * @see media_content_connect()
1015 * @see media_info_get_thumbnail_path()
1017 int media_info_generate_thumbnail(media_info_h media);
1020 * @deprecated Deprecated since 8.0.
1021 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1022 * @brief Starts face detection for the given image, asynchronously.
1023 * @details This function detects faces for given image item and calls the given callback function when the detection is completed. \n
1024 * The given callback function is called when the detection is completed. \n
1025 * To obtain the detected faces, call the media_info_foreach_face_from_db() function. \n
1026 * Supported image formats are jpg, png, and bmp.
1031 * @privilege %http://tizen.org/privilege/content.write \n
1032 * %http://tizen.org/privilege/mediastorage \n
1033 * %http://tizen.org/privilege/externalstorage
1035 * @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
1036 * If the face detection fails, the @a face_count argument in media_face_detection_completed_cb() will be set to 0. \n
1037 * The face detection of media items in external storage except MMC is not supported. \n
1038 * Since 5.5, if the format of media data is unsupported, this function returns an error and the callback will not be invoked.
1040 * @param[in] media The handle to the media info
1041 * @param[in] callback The callback function to be invoked when detection is completed
1042 * @param[in] user_data The user data to be passed to the callback function
1044 * @return @c 0 on success,
1045 * otherwise a negative error value
1047 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1048 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1049 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1050 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1051 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1052 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1053 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1054 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1055 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
1057 * @pre This function requires opened connection to content service by media_content_connect().
1059 * @see media_content_connect()
1060 * @see media_info_cancel_face_detection()
1062 int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API;
1065 * @deprecated Deprecated since 8.0.
1066 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1067 * @brief Cancels face detection of image for the given media.
1068 * @details This function cancels face detection for given media item. \n
1069 * If you cancel face detection request before callback is invoked, the callback registered by media_info_start_face_detection() function will not be invoked.
1074 * @privilege %http://tizen.org/privilege/content.write
1076 * @remarks If face detection is already done when you request the cancellation, this function returns #MEDIA_CONTENT_ERROR_INVALID_OPERATION
1078 * @param[in] media The handle to the media info
1080 * @return @c 0 on success,
1081 * otherwise a negative error value
1083 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1084 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1085 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1086 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1088 * @pre This function requires opened connection to content service by media_content_connect().
1090 * @see media_content_connect()
1091 * @see media_info_start_face_detection()
1093 int media_info_cancel_face_detection(media_info_h media) TIZEN_DEPRECATED_API;
1101 #endif /* __cplusplus */
1103 #endif /* __TIZEN_CONTENT_MEDIA_INFO_H__ */