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.
48 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
51 * @privilege %http://tizen.org/privilege/content.write \n
52 * %http://tizen.org/privilege/mediastorage \n
53 * %http://tizen.org/privilege/externalstorage
55 * @remarks The @a info should be released using media_info_destroy(). \n
56 * You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
57 * If you want to access only internal storage by using this function, you should add privilege http://tizen.org/privilege/mediastorage. \n
58 * Or if you want to access only external storage by using this function, you should add privilege http://tizen.org/privilege/externalstorage. \n
59 * If you can access both storage, you must add all privilege. \n
60 * Since 4.0, This function does not allow a symbolic link. \n
61 * @remarks Since 4.0, this function is related to the following feature:\n
62 * %http://tizen.org/feature/content.scanning.others\n
63 * If this feature is not supported on the device, MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
65 * @param[in] path The path of the content file to add
66 * @param[out] info The handle of the inserted content file
68 * @return @c 0 on success,
69 * otherwise a negative error value
71 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
72 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
73 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
74 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
75 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
76 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
77 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
78 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
79 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
81 * @pre This function requires opened connection to content service by media_content_connect().
83 * @see media_content_connect()
84 * @see media_content_scan_file()
85 * @see media_content_scan_folder()
87 int media_info_insert_to_db(const char *path, media_info_h *info);
90 * @brief Inserts content files into the media database, asynchronously.
91 * @details This function can insert multiple content files into the media database.
93 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
96 * @privilege %http://tizen.org/privilege/content.write \n
97 * %http://tizen.org/privilege/mediastorage \n
98 * %http://tizen.org/privilege/externalstorage
100 * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
101 * If you want to access only internal storage by using this function, you should add privilege http://tizen.org/privilege/mediastorage. \n
102 * Or if you want to access only external storage by using this function, you should add privilege http://tizen.org/privilege/externalstorage. \n
103 * If you can access both storage, you must add all privilege. \n
104 * Since 4.0, This function does not allow a symbolic link. \n
105 * @remarks Since 4.0, this function is related to the following feature:\n
106 * %http://tizen.org/feature/content.scanning.others\n
107 * If this feature is not supported on the device, MEDIA_CONTENT_TYPE_OTHERS type file is not scanned.
109 * @param[in] path_array The path array of the content files to add
110 * @param[in] array_length The length of the array
111 * @param[in] callback The callback function to be invoked when media items inserted completely
112 * @param[in] user_data The user data to be passed to the callback function
114 * @return @c 0 on success,
115 * otherwise a negative error value
117 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
118 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
119 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
120 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
121 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
122 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
123 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
124 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
125 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
127 * @pre This function requires opened connection to content service by media_content_connect().
129 * @see media_content_connect()
130 * @see media_insert_completed_cb()
132 int media_info_insert_batch_to_db(const char **path_array, unsigned int array_length, media_insert_completed_cb callback, void *user_data);
135 * @deprecated Deprecated since 5.0. Use media_content_scan_file() instead.
136 * @brief Deletes the media information from the media database.
137 * @details This function only remove media information in the media database. \n
138 * You can use media_content_scan_file()/media_content_scan_folder() function instead of this function if a file is removed from the file system.
140 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
143 * @privilege %http://tizen.org/privilege/content.write
145 * @param[in] media_id The media ID. It can get from media info handle.
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
152 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
153 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
154 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
155 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
156 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
158 * @pre This function requires opened connection to content service by media_content_connect().
160 * @see media_content_connect()
161 * @see media_content_scan_file()
162 * @see media_content_scan_folder()
164 int media_info_delete_from_db(const char *media_id) TIZEN_DEPRECATED_API;
168 * @brief Destroys media info.
169 * @details The function frees all resources related to the media info handle. This handle
170 * can no longer be used to perform any operations. New media info handle has to
171 * be created before the next usage.
173 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
175 * @param[in] media The handle to the media info
177 * @return @c 0 on success,
178 * otherwise a negative error value
180 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
181 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
183 * @pre Get copy of media_info handle by calling media_info_clone().
185 * @see media_info_clone()
187 int media_info_destroy(media_info_h media);
190 * @brief Clones the media info handle.
192 * @details This function copies the media info handle from a source to the destination.
193 * To use this handle outside of these foreach functions, use this function.
195 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
197 * @remarks The @a dst should be released using media_info_destroy().
199 * @param[out] dst The destination handle to the media info
200 * @param[in] src The source handle to the media info
202 * @return @c 0 on success,
203 * otherwise a negative error value
205 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
206 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
207 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
209 * @see media_info_destroy()
210 * @see media_album_foreach_media_from_db()
211 * @see media_playlist_foreach_media_from_db()
212 * @see media_group_foreach_media_from_db()
213 * @see media_tag_foreach_media_from_db()
214 * @see media_info_foreach_media_from_db()
215 * @see media_info_insert_to_db()
216 * @see media_folder_foreach_media_from_db()
218 int media_info_clone(media_info_h *dst, media_info_h src);
221 * @brief Gets the count of media info for the passed @a filter from the media database.
222 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
224 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
227 * @param[in] filter The handle to the media filter
228 * @param[out] media_count The count of media
230 * @return @c 0 on success,
231 * otherwise a negative error value
233 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
234 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
235 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
236 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
238 * @pre This function requires opened connection to content service by media_content_connect().
240 * @see media_content_connect()
241 * @see media_filter_create()
243 int media_info_get_media_count_from_db(filter_h filter, int *media_count);
246 * @brief Iterates through media info from the media database.
247 * @details This function gets all media info handles meeting the given @a filter.
248 * The @a callback function will be invoked for every retrieved media info.
249 * If @c NULL is passed to the @a filter, then no filtering is applied.
251 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
253 * @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,
254 * your callback function is invoked as inline function.
255 * So, your callback function is in read state in SQLite. When you are in read state, sometimes you do not update DB.
256 * We do not recommend you call updating DB function in callback of foreach function.
258 * @param[in] filter The handle to the media filter
259 * @param[in] callback The callback function to be invoked
260 * @param[in] user_data The user data to be passed to the callback function
262 * @return @c 0 on success,
263 * otherwise a negative error value
265 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
266 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
267 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
268 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
269 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
271 * @pre This function requires opened connection to content service by media_content_connect().
272 * @post This function invokes media_info_cb().
274 * @see media_content_connect()
275 * @see #media_info_cb
276 * @see media_filter_create()
278 int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data);
281 * @brief Gets the count of media tags for the passed @a filter in the given @a media_id from the media database.
282 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
284 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
286 * @param[in] media_id The media ID
287 * @param[in] filter The handle to the media filter
288 * @param[out] tag_count The count of the media tag
290 * @return @c 0 on success,
291 * otherwise a negative error value
293 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
294 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
295 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
296 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
298 * @pre This function requires opened connection to content service by media_content_connect().
300 * @see media_content_connect()
301 * @see media_filter_create()
303 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count);
306 * @brief Iterates through the media tag in the given media info from the media database.
307 * @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
308 * If @c NULL is passed to the @a filter, then no filtering is applied.
310 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
312 * @param[in] media_id The media ID
313 * @param[in] filter The handle to the media filter
314 * @param[in] callback The callback function to be invoked
315 * @param[in] user_data The user data to be passed to the callback function
317 * @return @c 0 on success,
318 * otherwise a negative error value
320 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
321 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
322 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
323 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
324 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
326 * @pre This function requires opened connection to content service by media_content_connect().
327 * @post This function invokes media_tag_cb().
329 * @see media_content_connect()
331 * @see media_filter_create()
333 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
336 * @brief Gets the number of bookmarks for the passed @a filter in the given media ID from the media database.
337 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
339 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
341 * @param[in] media_id The media ID
342 * @param[in] filter The handle to the media filter
343 * @param[out] bookmark_count The count of the media tag
345 * @return @c 0 on success,
346 * otherwise a negative error value
348 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
349 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
350 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
351 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
353 * @pre This function requires opened connection to content service by media_content_connect().
355 * @see media_content_connect()
356 * @see media_filter_create()
358 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count);
361 * @brief Iterates through the media bookmark in the given media info from the media database.
362 * @details This function gets all media bookmarks associated with the given media and calls @a callback for every retrieved media bookmark.
363 * If @c NULL is passed to the @a filter, then no filtering is applied.
365 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
367 * @param[in] media_id The media ID
368 * @param[in] filter The handle to the media filter
369 * @param[in] callback The callback function to be invoked
370 * @param[in] user_data The user data to be passed to the callback function
372 * @return @c 0 on success,
373 * otherwise a negative error value
375 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
376 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
377 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
378 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
379 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
381 * @pre This function requires opened connection to content service by media_content_connect().
382 * @post This function invokes media_bookmark_cb().
384 * @see media_content_connect()
385 * @see media_bookmark_cb()
386 * @see media_filter_create()
388 int media_info_foreach_bookmark_from_db(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
391 * @brief Gets the number of face for the passed @a media_id from the media database.
392 * @details If @c NULL is passed to the @a filter, then no filtering is applied.
396 * @param[in] media_id The media ID
397 * @param[in] filter The handle to the media filter
398 * @param[out] face_count The count of media face
400 * @return 0 on success, otherwise a negative error value.
402 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
403 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
404 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
406 * @pre This function requires opened connection to content service by media_content_connect().
407 * @see media_content_connect()
408 * @see media_filter_create()
411 int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count);
414 * @brief Iterates through the media files with optional @a filter in the given @a media_id from the media database.
415 * @details This function gets all media face info associated with the given media id and
416 * meeting desired filter option and calls @a callback for
417 * every retrieved media face info. If NULL is passed to the @a filter, no filtering is applied.
421 * @param[in] media_id The media ID
422 * @param[in] filter The handle to the media filter
423 * @param[in] callback The callback function to invoke
424 * @param[in] user_data The user data to be passed to the callback function
426 * @return 0 on success, otherwise a negative error value.
428 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
429 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
430 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
432 * @pre This function requires opened connection to content service by media_content_connect().
433 * @see media_content_connect()
434 * @see media_filter_create()
437 int media_info_foreach_face_from_db(const char *media_id, filter_h filter, media_face_cb callback, void *user_data);
440 * @brief Gets the image metadata handle for a given media info.
441 * @details This function returns an image metadata handle retrieved from the media info.
443 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
445 * @remarks The @a image should be released using image_meta_destroy().
447 * @param[in] media The handle to the media info
448 * @param[out] image The handle to the image metadata
450 * @return @c 0 on success,
451 * otherwise a negative error value
453 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
454 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
455 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
457 * @see image_meta_destroy()
459 int media_info_get_image(media_info_h media, image_meta_h *image);
462 * @brief Gets a video metadata handle for a given media info.
463 * @details This function returns a video metadata handle retrieved from the media info handle.
465 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
467 * @remarks The @a video should be released using video_meta_destroy().
469 * @param[in] media The handle to the media info
470 * @param[out] video The handle to the video metadata
472 * @return @c 0 on success,
473 * otherwise a negative error value
475 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
476 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
477 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
479 * @see video_meta_destroy()
481 int media_info_get_video(media_info_h media, video_meta_h *video);
484 * @brief Gets an audio metadata handle for a given media info.
485 * @details This function returns an audio metadata handle retrieved from the media info handle.
487 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
489 * @remarks The @a audio should be released using audio_meta_destroy().
491 * @param[in] media The handle to the media info
492 * @param[out] audio The handle to the audio metadata
494 * @return @c 0 on success,
495 * otherwise a negative error value
497 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
498 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
499 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
501 * @see audio_meta_destroy()
503 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
506 * @brief Gets the media ID.
507 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
508 * @remarks The @a media_id should be released using free().
510 * @param[in] media The handle to the media info
511 * @param[out] media_id The media ID
513 * @return @c 0 on success,
514 * otherwise a negative error value
516 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
517 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
518 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
520 int media_info_get_media_id(media_info_h media, char **media_id);
523 * @brief Gets the full path of the content file.
524 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
526 * @remarks The @a path should be released using free().
528 * @param[in] media The handle to the media info
529 * @param[out] path The full path of the content file
531 * @return @c 0 on success,
532 * otherwise a negative error value
534 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
535 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
536 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
539 int media_info_get_file_path(media_info_h media, char **path);
542 * @brief Gets the file name including the extension of the content file.
543 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
545 * @remarks The @a name should be released using free().
547 * @param[in] media The handle to the media info
548 * @param[out] name The file name including the extension of the content file
550 * @return @c 0 on success,
551 * otherwise a negative error value
553 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
554 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
555 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
557 int media_info_get_display_name(media_info_h media, char **name);
560 * @brief Gets the content type of the content file.
561 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
563 * @param[in] media The handle to the media info
564 * @param[out] type The content type of the content file (#media_content_type_e)
566 * @return @c 0 on success,
567 * otherwise a negative error value
569 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
570 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
572 * @see #media_content_type_e
574 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
577 * @brief Gets the MIME type of the content file.
578 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
580 * @remarks The @a mime_type should be released using free().
582 * @param[in] media The handle to the media info
583 * @param[out] mime_type The MIME type of the content file
585 * @return @c 0 on success,
586 * otherwise a negative error value
588 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
589 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
590 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
592 int media_info_get_mime_type(media_info_h media, char **mime_type);
595 * @brief Gets the content file size.
596 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
598 * @param[in] media The handle to the media info
599 * @param[out] size The content file size
601 * @return @c 0 on success,
602 * otherwise a negative error value
604 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
605 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
607 int media_info_get_size(media_info_h media, unsigned long long *size);
610 * @brief Gets the added time of the content file.
611 * @details The added time refers to the time that content file was first added to media database.
612 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
614 * @param[in] media The handle to the media info
615 * @param[out] added_time The added time to the media database
617 * @return @c 0 on success,
618 * otherwise a negative error value
620 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
621 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
623 int media_info_get_added_time(media_info_h media, time_t *added_time);
626 * @brief Gets the modified time of the content file.
627 * @details The modified time refers to the last modification time provided by the file system.
628 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
630 * @param[in] media The handle to the media info
631 * @param[out] time The last modification time of the content file
633 * @return @c 0 on success,
634 * otherwise a negative error value
636 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
637 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
639 int media_info_get_modified_time(media_info_h media, time_t *time);
642 * @brief Gets the timeline of content file.
643 * @details If the content file has the creation time information (like Content recorded date or Image creation date), that value is timeline. \n
644 * Otherwise, timeline value is the same as modified time.
645 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
647 * @param[in] media The handle to the media info
648 * @param[out] time The timeline of content file
650 * @return @c 0 on success,
651 * otherwise a negative error value
653 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
654 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
656 int media_info_get_timeline(media_info_h media, time_t *time);
659 * @brief Gets the thumbnail path of content file.
660 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
662 * @remarks The @a path should be released using free(). \n
663 * If the thumbnail extraction for the given media has not been requested yet, this function returns NULL. \n
664 * To create a thumbnail, you should use media_info_generate_thumbnail() function. \n
665 * This function returns an empty string if media_info_generate_thumbnail() has failed to create a thumbnail for the given media.
667 * @param[in] media The handle to the media info
668 * @param[out] path The thumbnail path
670 * @return @c 0 on success,
671 * otherwise a negative error value
673 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
674 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
675 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
677 int media_info_get_thumbnail_path(media_info_h media, char **path);
680 * @brief Gets the description of content file.
681 * @details If the value is an empty string, the method returns "Unknown". \n
682 * Since 3.0, if the media info has no description, the method returns empty string.
683 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
685 * @remarks The @a description should be released using free().
687 * @param[in] media The handle to the media info
688 * @param[out] description The description of the content file
690 * @return @c 0 on success,
691 * otherwise a negative error value
693 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
694 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
695 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
697 int media_info_get_description(media_info_h media, char **description);
700 * @brief Gets the longitude of content file.
701 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
703 * @param[in] media The handle to the media info
704 * @param[out] longitude The longitude of the content file
706 * @return @c 0 on success,
707 * otherwise a negative error value
709 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
710 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
712 int media_info_get_longitude(media_info_h media, double *longitude);
715 * @brief Gets the latitude of content file.
716 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
718 * @param[in] media The handle to the media info
719 * @param[out] latitude The latitude of the content file
721 * @return @c 0 on success,
722 * otherwise a negative error value
724 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
725 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
728 int media_info_get_latitude(media_info_h media, double* latitude);
731 * @brief Gets the altitude of content file.
732 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
734 * @param[in] media The handle to the media info
735 * @param[out] altitude The altitude of the content file
737 * @return @c 0 on success,
738 * otherwise a negative error value
740 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
741 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
743 int media_info_get_altitude(media_info_h media, double* altitude);
746 * @brief Gets the rating of content file.
747 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
749 * @param[in] media The handle to the media info
750 * @param[out] rating The rating of the content file
752 * @return @c 0 on success,
753 * otherwise a negative error value
755 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
756 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
758 int media_info_get_rating(media_info_h media, int *rating);
761 * @brief Gets the favorite status of content file which User set.
762 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
764 * @param[in] media The handle to the media info
765 * @param[out] favorite @c true if content file is set as favorite,
766 * otherwise @c false if content file is not set as favorite
768 * @return @c 0 on success,
769 * otherwise a negative error value
771 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
772 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
774 * @see media_info_set_favorite()
776 int media_info_get_favorite(media_info_h media, bool* favorite);
779 * @brief Gets the title of content file.
780 * @details If the content file does not have a title, this method returns the filename without the extension.
782 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
784 * @remarks The @a title should be released using free().
786 * @param[in] media The handle to the media info
787 * @param[out] title The title of the content file
789 * @return @c 0 on success,
790 * otherwise a negative error value
792 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
793 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
794 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
796 int media_info_get_title(media_info_h media, char **title);
799 * @deprecated Deprecated since 5.0.
800 * @brief Gets the storage id of content file.
801 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
803 * @remarks The @a storage_id should be released using free().
805 * @param[in] media The handle to the media info
806 * @param[out] storage_id The ID of the media storage
808 * @return @c 0 on success,
809 * otherwise a negative error value
811 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
812 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
813 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
815 int media_info_get_storage_id(media_info_h media, char **storage_id) TIZEN_DEPRECATED_API;
818 * @brief Checks whether the media is protected via DRM.
819 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
821 * @param[in] media The handle to the media info
822 * @param[out] is_drm @c true if media is DRM media,
823 * otherwise @c false if media is not DRM media
825 * @return @c 0 on success,
826 * otherwise a negative error value
828 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
829 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
831 int media_info_is_drm(media_info_h media, bool *is_drm);
834 * @brief Checks whether the content file is 360 content.
837 * @param[in] media The handle to the media info
838 * @param[out] is_360 @c true if media is 360 content,
839 * otherwise @c false if media is not 360 content
841 * @return @c 0 on success,
842 * otherwise a negative error value
844 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
845 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
847 int media_info_is_360_content(media_info_h media, bool *is_360);
850 * @deprecated Deprecated since 5.0. Use storage_get_type_dev() instead.
851 * @brief Gets the storage type of content file.
852 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
854 * @param[in] media The handle to the media info
855 * @param[out] storage_type The storage type of the content file
857 * @return @c 0 on success,
858 * otherwise a negative error value
860 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
861 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
863 int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type) TIZEN_DEPRECATED_API;
866 * @brief Gets the media info from the media database.
868 * @details This function creates a new media handle from the media database by the given @a media_id.
869 * Media info will be created and filled with information.
871 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
873 * @remarks The @a media should be released using media_info_destroy().
875 * @param[in] media_id The media ID
876 * @param[out] media The handle to the media info
878 * @return @c 0 on success,
879 * otherwise a negative error value
881 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
882 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
883 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
884 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
885 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
887 * @pre This function requires opened connection to content service by media_content_connect().
889 * @see media_content_connect()
890 * @see media_info_destroy()
892 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
895 * @brief Sets the favorite of media info.
896 * @details This function can mark favorite of the media. If set to @c true, this function record the time of the change moment. \n
897 * So, If you use it in order parameter, you can sort the order of the time was a favorite. \n
898 * Or, if you use it in condition parameter, you can get the result of the favorite media.
900 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
902 * @param[in] media The handle to the media info
903 * @param[in] favorite Set @c true to set the media info as favorite,
904 * otherwise set @c false to not set the media info as favorite
906 * @return @c 0 on success,
907 * otherwise a negative error value
909 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
910 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
912 int media_info_set_favorite(media_info_h media, bool favorite);
915 * @brief Updates the media info to the media database.
917 * @details The function updates the given media info in the media database.
919 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
921 * @privilege %http://tizen.org/privilege/content.write
923 * @remarks The function should be called after any change in media, to be updated to the media
924 * database. For example, after using media_info_set_favorite()
925 * for setting the name of the media, the media_info_update_to_db() function should be called so as to update
926 * the given media info attributes in the media database.
928 * @param[in] media The handle to the media info
930 * @return @c 0 on success,
931 * otherwise a negative error value
933 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
934 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
935 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
936 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
937 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
938 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
939 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
940 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
942 * @pre This function requires opened connection to content service by media_content_connect().
944 * @see media_content_connect()
945 * @see media_info_set_favorite()
947 int media_info_update_to_db(media_info_h media);
950 * @brief Moves the media info to the given destination path in the media database.
951 * @details After moving or renaming a file in the filesystem, call this function to update the database. \n
952 * If the source path and destination path are the same, then this function does nothing.
953 * If you want to refresh media information, you should use media_content_scan_file() function.
955 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
958 * @privilege %http://tizen.org/privilege/content.write \n
959 * %http://tizen.org/privilege/mediastorage \n
960 * %http://tizen.org/privilege/externalstorage
962 * @remarks You must add privilege http://tizen.org/privilege/content.write. And You add more privilege depending on your choice of contents path. \n
963 * If you want to access only internal storage by using this function, you should add privilege http://tizen.org/privilege/mediastorage. \n
964 * Or if you want to access only external storage by using this function, you should add privilege http://tizen.org/privilege/externalstorage. \n
965 * If you can access both storage, you should add all privilege. \n
966 * Since 4.0, this function does not allow symbolic links. \n
967 * This function does not support USB storage before 5.0. Since 5.0, USB storage is supported. \n
968 * Since 5.0, the thumbnail is removed if it exists.
970 * @param[in] media The handle to the media info
971 * @param[in] dst_path The path of destination
973 * @return @c 0 on success,
974 * otherwise a negative error value
976 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
977 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter (Especially, if the request is duplicated, this error returns.)
978 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
979 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
980 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
981 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
982 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
983 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
985 * @pre This function requires opened connection to content service by media_content_connect().
987 * @see media_content_connect()
988 * @see media_content_scan_folder()
989 * @see media_info_generate_thumbnail()
991 int media_info_move_to_db(media_info_h media, const char* dst_path);
994 * @deprecated Deprecated since 5.0. Use media_info_generate_thumbnail() instead.
995 * @brief Creates a thumbnail file for the given media, asynchronously.
996 * @details This function creates an thumbnail file for given media item and calls @a callback for completion of creating the thumbnail.
997 * If a thumbnail already exists for the given media, then the path of thumbnail will be returned in callback function. \n
998 * Since 3.0, a thumbnail is not automatically extracted during media scanning. \n
999 * Therefore, if there exists no thumbnail for the given media, you MUST call this function to create a thumbnail.
1001 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1004 * @privilege %http://tizen.org/privilege/content.write \n
1005 * %http://tizen.org/privilege/mediastorage \n
1006 * %http://tizen.org/privilege/externalstorage
1008 * @remarks If you want to destroy media handle before callback invoked, you must cancel thumbnail request by using media_info_cancel_thumbnail() \n
1009 * Since 3.0, if creation of a thumbnail is failed, empty string will be passed through media_thumbnail_completed_cb().
1010 * Items in external storage except MMC not supported.
1012 * @param[in] media The handle to the media info
1013 * @param[in] callback The callback function to be invoked
1014 * @param[in] user_data The user data to be passed to the callback function
1016 * @return @c 0 on success,
1017 * otherwise a negative error value
1019 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1020 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1021 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1022 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1023 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1024 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1025 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1026 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1028 * @pre This function requires opened connection to content service by media_content_connect().
1030 * @see media_content_connect()
1032 int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API;
1035 * @deprecated Deprecated since 5.0.
1036 * @brief Cancels the creation of thumbnail file for the given media.
1037 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1040 * @privilege %http://tizen.org/privilege/content.write
1042 * @remarks If you request cancel for the already thumbnail created media, this function return MEDIA_CONTENT_ERROR_INVALID_OPERATION
1044 * @param[in] media The handle to the media info
1046 * @return @c 0 on success,
1047 * otherwise a negative error value
1049 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1050 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1051 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1052 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1054 * @pre This function requires opened connection to content service by media_content_connect().
1055 * @see media_content_connect()
1057 int media_info_cancel_thumbnail(media_info_h media) TIZEN_DEPRECATED_API;
1060 * @brief Generates a thumbnail file for the given media, synchronously.
1065 * @privilege %http://tizen.org/privilege/content.write
1067 * @remarks http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
1068 * http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
1069 * Items in external storage are not supported, with the exception of MMC.
1071 * @param[in] media The handle to the media info
1073 * @return @c 0 on success,
1074 * otherwise a negative error value
1076 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1077 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1078 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1079 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1080 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1081 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1082 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1083 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1085 * @pre This function requires opened connection to content service by media_content_connect().
1087 * @see media_content_connect()
1088 * @see media_info_get_thumbnail_path()
1090 int media_info_generate_thumbnail(media_info_h media);
1093 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1094 * @brief Starts face detection for the given image, asynchronously.
1095 * @details This function detects faces for given image item and calls the given callback function when the detection is completed. \n
1096 * The given callback function is called when the detection is completed. \n
1097 * To obtain the detected faces, call the media_info_foreach_face_from_db() function.
1102 * @privilege %http://tizen.org/privilege/content.write \n
1103 * %http://tizen.org/privilege/mediastorage \n
1104 * %http://tizen.org/privilege/externalstorage
1106 * @remarks If you want to destroy the media handle before callback invoked, you must cancel the face detection request by using media_info_cancel_face_detection(). \n
1107 * If face detection fails, the face_count argument in media_face_detection_completed_cb() will be set to 0.
1108 * Media items in external storage are not supported, with the exception of MMC items.
1110 * @param[in] media The handle to the media info
1111 * @param[in] callback The callback function to be invoked when detection is completed
1112 * @param[in] user_data The user data to be passed to the callback function
1114 * @return @c 0 on success,
1115 * otherwise a negative error value
1117 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1118 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1119 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
1120 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1121 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
1122 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
1123 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
1124 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1125 * @retval #MEDIA_CONTENT_ERROR_NOT_SUPPORTED Not supported
1127 * @pre This function requires opened connection to content service by media_content_connect().
1129 * @see media_content_connect()
1130 * @see media_info_cancel_face_detection()
1132 int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data);
1135 * @ingroup CAPI_CONTENT_MEDIA_FACE_DETECTION_MODULE
1136 * @brief Cancels face detection of image for the given media.
1137 * @details This function cancels face detection for given media item. \n
1138 * If you cancel face detection request before callback is invoked, the callback registered by media_info_start_face_detection() function will not be invoked.
1143 * @privilege %http://tizen.org/privilege/content.write
1145 * @remarks If face detection is already done when you request the cancellation, this function return MEDIA_CONTENT_ERROR_INVALID_OPERATION
1147 * @param[in] media The handle to the media info
1149 * @return @c 0 on success,
1150 * otherwise a negative error value
1152 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
1153 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
1154 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
1155 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
1157 * @pre This function requires opened connection to content service by media_content_connect().
1159 * @see media_content_connect()
1160 * @see media_info_start_face_detection()
1162 int media_info_cancel_face_detection(media_info_h media);
1170 #endif /* __cplusplus */
1172 #endif /* __TIZEN_CONTENT_MEDIA_INFO_H__ */