Remove profile tag
[platform/core/api/media-content.git] / include_product / media_info.h
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #ifndef __TIZEN_CONTENT_MEDIA_INFO_H__
19 #define __TIZEN_CONTENT_MEDIA_INFO_H__
20
21 #include <media_content_type.h>
22
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29 /**
30  * @file media_info.h
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.
35  */
36
37
38 /**
39  * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
40  * @{
41  */
42
43 /**
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).
50  *
51  * @since_tizen 2.3
52  *
53  * @privlevel public
54  * @privilege %http://tizen.org/privilege/content.write \n
55  *                   %http://tizen.org/privilege/mediastorage \n
56  *                   %http://tizen.org/privilege/externalstorage
57  *
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.
67  *
68  * @param[in] path The path of the content file to add
69  * @param[out] info The handle of the inserted content file
70  *
71  * @return @c 0 on success,
72  *         otherwise a negative error value
73  *
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
83  *
84  * @pre This function requires opened connection to content service by media_content_connect().
85  *
86  * @see media_content_connect()
87  * @see media_content_scan_file()
88  * @see media_content_scan_folder()
89  */
90 int media_info_insert_to_db(const char *path, media_info_h *info);
91
92 /**
93  * @brief Inserts content files into the media database, asynchronously.
94  * @details This function can insert multiple content files into the media database.
95  *
96  * @since_tizen 2.3
97  *
98  * @privlevel public
99  * @privilege %http://tizen.org/privilege/content.write \n
100  *                   %http://tizen.org/privilege/mediastorage \n
101  *                   %http://tizen.org/privilege/externalstorage
102  *
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.
111  *
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
116  *
117  * @return @c 0 on success,
118  *         otherwise a negative error value
119  *
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
129  *
130  * @pre This function requires opened connection to content service by media_content_connect().
131  *
132  * @see media_content_connect()
133  * @see media_insert_completed_cb()
134  */
135 int media_info_insert_batch_to_db(const char **path_array, unsigned int array_length, media_insert_completed_cb callback, void *user_data);
136
137 /**
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.
142  *
143  * @since_tizen 2.3
144  *
145  * @param[in] media The handle to the media info
146  *
147  * @return @c 0 on success,
148  *         otherwise a negative error value
149  *
150  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
151  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
152  *
153  * @pre Get copy of media_info handle by calling media_info_clone().
154  *
155  * @see media_info_clone()
156  */
157 int media_info_destroy(media_info_h media);
158
159 /**
160  * @brief Clones the media info handle.
161  *
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.
164  *
165  * @since_tizen 2.3
166  *
167  * @remarks The @a dst should be released using media_info_destroy().
168  *
169  * @param[out] dst The destination handle to the media info
170  * @param[in] src The source handle to the media info
171  *
172  * @return @c 0 on success,
173  *         otherwise a negative error value
174  *
175  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
176  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY     Out of memory
177  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
178  *
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()
187  */
188 int media_info_clone(media_info_h *dst, media_info_h src);
189
190 /**
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.
193  *
194  * @since_tizen 2.3
195  *
196  *
197  * @param[in] filter The handle to the media filter
198  * @param[out] media_count The count of media
199  *
200  * @return @c 0 on success,
201  *         otherwise a negative error value
202  *
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
207  *
208  * @pre This function requires opened connection to content service by media_content_connect().
209  *
210  * @see media_content_connect()
211  * @see media_filter_create()
212  */
213 int media_info_get_media_count_from_db(filter_h filter, int *media_count);
214
215 /**
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.
220  *
221  * @since_tizen 2.3
222  *
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.
227  *
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
231  *
232  * @return @c 0 on success,
233  *         otherwise a negative error value
234  *
235  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
236  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
237  * @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
240  *
241  * @pre  This function requires opened connection to content service by media_content_connect().
242  * @post This function invokes media_info_cb().
243  *
244  * @see media_content_connect()
245  * @see #media_info_cb
246  * @see media_filter_create()
247  */
248 int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data);
249
250 /**
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.
253  *
254  * @since_tizen 2.3
255  *
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
259  *
260  * @return @c 0 on success,
261  *         otherwise a negative error value
262  *
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
267  *
268  * @pre This function requires opened connection to content service by media_content_connect().
269  *
270  * @see media_content_connect()
271  * @see media_filter_create()
272  */
273 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count);
274
275 /**
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.
279  *
280  * @since_tizen 2.3
281  *
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
286  *
287  * @return @c 0 on success,
288  *         otherwise a negative error value
289  *
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
295  *
296  * @pre  This function requires opened connection to content service by media_content_connect().
297  * @post This function invokes media_tag_cb().
298  *
299  * @see media_content_connect()
300  * @see #media_tag_cb
301  * @see media_filter_create()
302  */
303 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
304
305 /**
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.
308  *
309  * @since_tizen 2.3
310  *
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
314  *
315  * @return @c 0 on success,
316  *         otherwise a negative error value
317  *
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
322  *
323  * @pre This function requires opened connection to content service by media_content_connect().
324  *
325  * @see media_content_connect()
326  * @see media_filter_create()
327  */
328 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count);
329
330 /**
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.
334  *
335  * @since_tizen 2.3
336  *
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
341  *
342  * @return @c 0 on success,
343  *         otherwise a negative error value
344  *
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
350  *
351  * @pre  This function requires opened connection to content service by media_content_connect().
352  * @post This function invokes media_bookmark_cb().
353  *
354  * @see media_content_connect()
355  * @see media_bookmark_cb()
356  * @see media_filter_create()
357  */
358 int media_info_foreach_bookmark_from_db(const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
359
360 /**
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.
364  *
365  * @since_tizen 3.0
366  *
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
370  *
371  * @return 0 on success, otherwise a negative error value.
372  *
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
376  *
377  * @pre This function requires opened connection to content service by media_content_connect().
378  * @see media_content_connect()
379  * @see media_filter_create()
380  *
381  */
382 int media_info_get_face_count_from_db(const char *media_id, filter_h filter, int *face_count) TIZEN_DEPRECATED_API;
383
384 /**
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.
390  *
391  * @since_tizen 3.0
392  *
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
397  *
398  * @return 0 on success, otherwise a negative error value.
399  *
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
403  *
404  * @pre This function requires opened connection to content service by media_content_connect().
405  * @see media_content_connect()
406  * @see media_filter_create()
407  *
408  */
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;
410
411 /**
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.
414  *
415  * @since_tizen 2.3
416  *
417  * @remarks The @a image should be released using image_meta_destroy().
418  *
419  * @param[in] media The handle to the media info
420  * @param[out] image The handle to the image metadata
421  *
422  * @return @c 0 on success,
423  *         otherwise a negative error value
424  *
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
428  *
429  * @see image_meta_destroy()
430  */
431 int media_info_get_image(media_info_h media, image_meta_h *image);
432
433 /**
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.
436  *
437  * @since_tizen 2.3
438  *
439  * @remarks The @a video should be released using video_meta_destroy().
440  *
441  * @param[in] media The handle to the media info
442  * @param[out] video The handle to the video metadata
443  *
444  * @return @c 0 on success,
445  *         otherwise a negative error value
446  *
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
450  *
451  * @see video_meta_destroy()
452  */
453 int media_info_get_video(media_info_h media, video_meta_h *video);
454
455 /**
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.
458  *
459  * @since_tizen 2.3
460  *
461  * @remarks The @a audio should be released using audio_meta_destroy().
462  *
463  * @param[in] media The handle to the media info
464  * @param[out] audio The handle to the audio metadata
465  *
466  * @return @c 0 on success,
467  *         otherwise a negative error value
468  *
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
472  *
473  * @see audio_meta_destroy()
474  */
475 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
476
477 /**
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.
481  *
482  * @since_tizen 6.5
483  *
484  * @remarks The @a book should be released using book_meta_destroy().
485  *
486  * @param[in] media The handle to the media info
487  * @param[out] book The handle to the book metadata
488  *
489  * @return @c 0 on success,
490  *         otherwise a negative error value
491  *
492  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
493  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
494  *
495  * @see media_info_get_title()
496  * @see media_info_get_description()
497  * @see book_meta_destroy()
498  */
499 int media_info_get_book(media_info_h media, book_meta_h *book);
500
501 /**
502  * @brief Gets the media ID.
503  * @since_tizen 2.3
504  * @remarks The @a media_id should be released using free().
505  *
506  * @param[in] media The handle to the media info
507  * @param[out] media_id The media ID
508  *
509  * @return @c 0 on success,
510  *         otherwise a negative error value
511  *
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
515  */
516 int media_info_get_media_id(media_info_h media, char **media_id);
517
518 /**
519  * @brief Gets the full path of the content file.
520  * @since_tizen 2.3
521  *
522  * @remarks The @a path should be released using free().
523  *
524  * @param[in] media The handle to the media info
525  * @param[out] path The full path of the content file
526  *
527  * @return @c 0 on success,
528  *         otherwise a negative error value
529  *
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
533  *
534  */
535 int media_info_get_file_path(media_info_h media, char **path);
536
537 /**
538  * @brief Gets the file name including the extension of the content file.
539  * @since_tizen 2.3
540  *
541  * @remarks The @a name should be released using free().
542  *
543  * @param[in] media The handle to the media info
544  * @param[out] name The file name including the extension of the content file
545  *
546  * @return @c 0 on success,
547  *         otherwise a negative error value
548  *
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
552  */
553 int media_info_get_display_name(media_info_h media, char **name);
554
555 /**
556  * @brief Gets the content type of the content file.
557  * @since_tizen 2.3
558  *
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)
561  *
562  * @return @c 0 on success,
563  *         otherwise a negative error value
564  *
565  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
566  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
567  *
568  * @see #media_content_type_e
569  */
570 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
571
572 /**
573  * @brief Gets the MIME type of the content file.
574  * @since_tizen 2.3
575  *
576  * @remarks The @a mime_type should be released using free().
577  *
578  * @param[in] media The handle to the media info
579  * @param[out] mime_type The MIME type of the content file
580  *
581  * @return @c 0 on success,
582  *         otherwise a negative error value
583  *
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
587  */
588 int media_info_get_mime_type(media_info_h media, char **mime_type);
589
590 /**
591  * @brief Gets the content file size.
592  * @since_tizen 2.3
593  *
594  * @param[in] media The handle to the media info
595  * @param[out] size The content file size
596  *
597  * @return @c 0 on success,
598  *         otherwise a negative error value
599  *
600  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
601  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
602  */
603 int media_info_get_size(media_info_h media, unsigned long long *size);
604
605 /**
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 2.3
609  *
610  * @param[in] media The handle to the media info
611  * @param[out] added_time The added time to the media database
612  *
613  * @return @c 0 on success,
614  *         otherwise a negative error value
615  *
616  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
617  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
618  */
619 int media_info_get_added_time(media_info_h media, time_t *added_time);
620
621 /**
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 2.3
625  *
626  * @param[in] media The handle to the media info
627  * @param[out] time The last modification time of the content file
628  *
629  * @return @c 0 on success,
630  *         otherwise a negative error value
631  *
632  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
633  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
634  */
635 int media_info_get_modified_time(media_info_h media, time_t *time);
636
637 /**
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 2.3
642  *
643  * @param[in] media The handle to the media info
644  * @param[out] time The timeline of content file
645  *
646  * @return @c 0 on success,
647  *         otherwise a negative error value
648  *
649  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
650  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
651  */
652 int media_info_get_timeline(media_info_h media, time_t *time);
653
654 /**
655  * @brief Gets the thumbnail path of content file.
656  * @since_tizen 2.3
657  *
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.
662  *
663  * @param[in] media The handle to the media info
664  * @param[out] path The thumbnail path
665  *
666  * @return @c 0 on success,
667  *         otherwise a negative error value
668  *
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
672  */
673 int media_info_get_thumbnail_path(media_info_h media, char **path);
674
675 /**
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 2.3
680  *
681  * @remarks The @a description should be released using free().
682  *
683  * @param[in] media The handle to the media info
684  * @param[out] description The description of the content file
685  *
686  * @return @c 0 on success,
687  *         otherwise a negative error value
688  *
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
692  */
693 int media_info_get_description(media_info_h media, char **description);
694
695 /**
696  * @brief Gets the longitude of content file.
697  * @since_tizen 2.3
698  *
699  * @param[in] media The handle to the media info
700  * @param[out] longitude The longitude of the content file
701  *
702  * @return @c 0 on success,
703  *         otherwise a negative error value
704  *
705  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
706  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
707  */
708 int media_info_get_longitude(media_info_h media, double *longitude);
709
710 /**
711  * @brief Gets the latitude of content file.
712  * @since_tizen 2.3
713  *
714  * @param[in] media The handle to the media info
715  * @param[out] latitude The latitude of the content file
716  *
717  * @return @c 0 on success,
718  *         otherwise a negative error value
719  *
720  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
721  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
722  *
723  */
724 int media_info_get_latitude(media_info_h media, double* latitude);
725
726 /**
727  * @brief Gets the altitude of content file.
728  * @since_tizen 2.3
729  *
730  * @param[in] media The handle to the media info
731  * @param[out] altitude The altitude of the content file
732  *
733  * @return @c 0 on success,
734  *         otherwise a negative error value
735  *
736  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
737  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
738  */
739 int media_info_get_altitude(media_info_h media, double* altitude);
740
741 /**
742  * @brief Gets the rating of content file.
743  * @since_tizen 2.3
744  *
745  * @param[in] media The handle to the media info
746  * @param[out] rating The rating of the content file
747  *
748  * @return @c 0 on success,
749  *         otherwise a negative error value
750  *
751  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
752  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
753  */
754 int media_info_get_rating(media_info_h media, int *rating);
755
756 /**
757  * @brief Gets the favorite status of content file which User set.
758  * @since_tizen 2.3
759  *
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
763  *
764  * @return @c 0 on success,
765  *         otherwise a negative error value
766  *
767  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
768  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
769  *
770  * @see media_info_set_favorite()
771  */
772 int media_info_get_favorite(media_info_h media, bool* favorite);
773
774 /**
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.
777  *
778  * @since_tizen 2.3
779  *
780  * @remarks The @a title should be released using free().
781  *
782  * @param[in] media The handle to the media info
783  * @param[out] title The title of the content file
784  *
785  * @return @c 0 on success,
786  *         otherwise a negative error value
787  *
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
791  */
792 int media_info_get_title(media_info_h media, char **title);
793
794 /**
795  * @brief Checks whether the media is protected via DRM.
796  * @since_tizen 2.3
797  *
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
801  *
802  * @return @c 0 on success,
803  *         otherwise a negative error value
804  *
805  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
806  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
807  */
808 int media_info_is_drm(media_info_h media, bool *is_drm);
809
810 /**
811  * @brief Checks whether the content file is 360 content.
812  * @since_tizen 3.0
813  *
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
817  *
818  * @return @c 0 on success,
819  *         otherwise a negative error value
820  *
821  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
822  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
823  */
824 int media_info_is_360_content(media_info_h media, bool *is_360);
825
826 /**
827  * @brief Gets the media info from the media database.
828  *
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.
831  *
832  * @since_tizen 2.3
833  *
834  * @remarks The @a media should be released using media_info_destroy().
835  *
836  * @param[in] media_id The media ID
837  * @param[out] media The handle to the media info
838  *
839  * @return @c 0 on success,
840  *         otherwise a negative error value
841  *
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
847  *
848  * @pre This function requires opened connection to content service by media_content_connect().
849  *
850  * @see media_content_connect()
851  * @see media_info_destroy()
852  */
853 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
854
855 /**
856  * @brief Gets the media info from the media database using path.
857  *
858  * @details This function creates a new media handle filled with information from the database by the given @a media_path.
859  *
860  * @since_tizen 6.5
861  *
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
866  *
867  * @param[in] media_path The media path
868  * @param[out] media The handle to the media info
869  *
870  * @return @c 0 on success,
871  *         otherwise a negative error value
872  *
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
879  *
880  * @pre This function requires opened connection to content service by media_content_connect().
881  *
882  * @see media_content_connect()
883  * @see media_info_destroy()
884  */
885 int media_info_get_media_from_db_by_path(const char *media_path, media_info_h *media);
886
887 /**
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.
892  *
893  * @since_tizen 2.3
894  *
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
898  *
899  * @return @c 0 on success,
900  *         otherwise a negative error value
901  *
902  * @retval #MEDIA_CONTENT_ERROR_NONE              Successful
903  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
904  */
905 int media_info_set_favorite(media_info_h media, bool favorite);
906
907 /**
908  * @brief Updates the media info to the media database.
909  *
910  * @details The function updates the given media info in the media database.
911  *
912  * @since_tizen 2.3
913  * @privlevel public
914  * @privilege %http://tizen.org/privilege/content.write
915  *
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.
920  *
921  * @param[in] media The handle to the media info
922  *
923  * @return @c 0 on success,
924  *         otherwise a negative error value
925  *
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
934  *
935  * @pre This function requires opened connection to content service by media_content_connect().
936  *
937  * @see media_content_connect()
938  * @see media_info_set_favorite()
939  */
940 int media_info_update_to_db(media_info_h media);
941
942 /**
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.
947  *
948  * @since_tizen 2.3
949  *
950  * @privlevel public
951  * @privilege %http://tizen.org/privilege/content.write \n
952  *                   %http://tizen.org/privilege/mediastorage \n
953  *                   %http://tizen.org/privilege/externalstorage
954  *
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.
962  *
963  * @param[in] media The handle to the media info
964  * @param[in] dst_path The path of destination
965  *
966  * @return @c 0 on success,
967  *         otherwise a negative error value
968  *
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
977  *
978  * @pre This function requires opened connection to content service by media_content_connect().
979  *
980  * @see media_content_connect()
981  * @see media_content_scan_folder()
982  * @see media_info_generate_thumbnail()
983  */
984 int media_info_move_to_db(media_info_h media, const char* dst_path);
985
986 /**
987  * @brief Generates a thumbnail file for the given media, synchronously.
988  *
989  * @since_tizen 5.0
990  *
991  * @privlevel public
992  * @privilege %http://tizen.org/privilege/content.write
993  *
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.
997  *
998  * @param[in] media The handle to the media info
999  *
1000  * @return @c 0 on success,
1001  *         otherwise a negative error value
1002  *
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
1011  *
1012  * @pre This function requires opened connection to content service by media_content_connect().
1013  *
1014  * @see media_content_connect()
1015  * @see media_info_get_thumbnail_path()
1016  */
1017 int media_info_generate_thumbnail(media_info_h media);
1018
1019 /**
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.
1027  *
1028  * @since_tizen 3.0
1029  *
1030  * @privlevel public
1031  * @privilege %http://tizen.org/privilege/content.write \n
1032  *                   %http://tizen.org/privilege/mediastorage \n
1033  *                   %http://tizen.org/privilege/externalstorage
1034  *
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.
1039  *
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
1043  *
1044  * @return @c 0 on success,
1045  *         otherwise a negative error value
1046  *
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
1056  *
1057  * @pre This function requires opened connection to content service by media_content_connect().
1058  *
1059  * @see media_content_connect()
1060  * @see media_info_cancel_face_detection()
1061  */
1062 int media_info_start_face_detection(media_info_h media, media_face_detection_completed_cb callback, void *user_data) TIZEN_DEPRECATED_API;
1063
1064 /**
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.
1070  *
1071  * @since_tizen 3.0
1072  *
1073  * @privlevel public
1074  * @privilege %http://tizen.org/privilege/content.write
1075  *
1076  * @remarks If face detection is already done when you request the cancellation, this function returns #MEDIA_CONTENT_ERROR_INVALID_OPERATION
1077  *
1078  * @param[in] media The handle to the media info
1079  *
1080  * @return @c 0 on success,
1081  *         otherwise a negative error value
1082  *
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
1087  *
1088  * @pre This function requires opened connection to content service by media_content_connect().
1089  *
1090  * @see media_content_connect()
1091  * @see media_info_start_face_detection()
1092  */
1093 int media_info_cancel_face_detection(media_info_h media) TIZEN_DEPRECATED_API;
1094
1095 /**
1096  * @}
1097  */
1098
1099 #ifdef __cplusplus
1100 }
1101 #endif /* __cplusplus */
1102
1103 #endif /* __TIZEN_CONTENT_MEDIA_INFO_H__ */