merge with master
[platform/core/api/media-content.git] / include / 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_MEDIA_INFORMATION_H__
19 #define __TIZEN_MEDIA_INFORMATION_H__
20
21 #include <media_content_type.h>
22
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29
30 /**
31  * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
32  * @{
33  */
34
35 /**
36  * @brief Inserts media file into the media database.
37  * @details This function inserts an media item into the content storage.
38  * Normally, inserting a media file in database is done automatically by media server, without calling this function.
39  * This function is only called when media server is busy and user needs to get quick result of inserting
40  * e.g. Taking a photo while media server is busy and user want to see the quick snapshot of the photo taken.
41  * @remark The handle must be released with media_info_destroy() by you.
42  *
43  * @param[in] path The path to the media file
44  * @param[out] info The handle to the media info
45  * @return 0 on success, otherwise a negative error value.
46  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
47  * @pre This function requires opened connection to content service by media_content_connect().
48  * @see media_content_connect()
49  */
50 int media_info_insert_to_db (const char *path, media_info_h *info);
51
52 /**
53  * @brief Insert media files into the media database, asynchronously.
54  * @details This function insert an media items into the content storage.
55  * Normally, inserting a media file in database is done automatically by media server, without calling this function.
56  * This function invokes media_insert_completed_cb callback function.
57  * #media_insert_completed_cb will be called when insertion to media database is finished.
58  *
59  * @param[in] path_array The path array to the media files
60  * @param[in] array_length The length of array
61  * @param[in] callback The callback to invoke when media items inserted completely
62  * @param[in] user_data The user data to be passed to the callback function
63  * @return 0 on success, otherwise a negative error value.
64  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
65  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
66  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
67  * @pre This function requires opened connection to content service by media_content_connect().
68  * @see media_content_connect()
69  * @see media_insert_completed_cb()
70  */
71 int media_info_insert_batch_to_db(const char **path_array,unsigned int array_length, media_insert_completed_cb callback, void *user_data);
72
73 /**
74  * @brief Insert the burst shot images into the media database, asynchronously.
75  * @details This function insert the busrt images into the content storage.
76  * #media_insert_burst_shot_completed_cb will be called when insertion to media database is finished.
77  *
78  * @param[in] path_array The path array to the burst shot images
79  * @param[in] array_length The length of array
80  * @param[in] callback The callback to invoke when the images inserted completely
81  * @param[in] user_data The user data to be passed to the callback function
82  * @return 0 on success, otherwise a negative error value.
83  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
84  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
85  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
86  * @pre This function requires opened connection to content service by media_content_connect().
87  * @see media_content_connect()
88  * @see media_insert_burst_shot_completed_cb()
89  */
90 int media_info_insert_burst_shot_to_db(const char **path_array,unsigned int array_length, media_insert_burst_shot_completed_cb callback, void *user_data);
91
92 /**
93  * @brief Deletes media file from the media database.
94  * @details This function deletes an media item from the content storage.
95  * Normally, deleting a media file in database is done automatically by media server, without calling this function.
96  * This function is only called when media server is busy and user needs to get quick result of deleting
97  *
98  * @param[in] media_id The ID to the media file
99  * @return 0 on success, otherwise a negative error value.
100  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
101  * @pre This function requires opened connection to content service by media_content_connect().
102  * @see media_content_connect()
103  */
104 int media_info_delete_from_db(const char *media_id);
105
106 /**
107  * @brief Deletes media files from the media database. The media files to delete can be specified as a condition in a filter.
108  * @details This function deletes the media items from the content storage.
109  * Normally, deleting  media files in database are done automatically by media server, without calling this function.
110  * This function is only called when media server is busy and user needs to get quick result of deleting
111  *
112  * @param[in] filter The handle to filter
113  * @return 0 on success, otherwise a negative error value.
114  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
115  * @pre This function requires opened connection to content service by media_content_connect().
116  * @see media_content_connect()
117  */
118 int media_info_delete_batch_from_db(filter_h filter);
119
120
121 /**
122  * @brief Destroys the media info.
123  * @details The function frees all resources related to the media info handle. This handle
124  * no longer can be used to perform any operation. New media info handle has to
125  * be created before next usage.
126  *
127  * @param[in] media The handle to media info
128  * @return 0 on success, otherwise a negative error value.
129  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
130  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
131  * @pre Get copy of media_info handle by calling media_info_clone()
132  * @see media_info_clone()
133  */
134 int media_info_destroy(media_info_h media);
135
136 /**
137  * @brief Clones the media info handle.
138  *
139  * @details This function copies the media info handle from a source to destination.
140  * There is no media_info_create() function. The media_info_h is created internally and
141  * available through media info foreach function such as media_info_foreach_media_from_db().
142  * To use this handle outside of these foreach functions, use this function.
143  * @remark The destination handle must be released with media_info_destroy() by you.
144  *
145  * @param[out] dst A destination handle to media info
146  * @param[in] src The source handle to media info
147  * @return 0 on success, otherwise a negative error value.
148  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
149  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
150  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
151  * @see media_info_destroy()
152  * @see media_album_foreach_media_from_db()
153  * @see media_playlist_foreach_media_from_db()
154  * @see media_group_foreach_media_from_db
155  * @see media_tag_foreach_media_from_db()
156  * @see media_info_foreach_media_from_db()
157  * @see media_folder_foreach_media_from_db()
158  *
159  */
160 int media_info_clone(media_info_h *dst, media_info_h src);
161
162 /**
163  * @brief Gets the number of media info for the passed @a filter from the media database.
164  *
165  * @param[in] filter The handle to filter.
166  * @param[out] media_count The count of media tag
167  * @return 0 on success, otherwise a negative error value.
168  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
169  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
170  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
171  * @pre This function requires opened connection to content service by media_content_connect().
172  * @see media_content_connect()
173  *
174  */
175 int media_info_get_media_count_from_db(filter_h filter, int *media_count);
176
177 /**
178  * @brief Iterates through media info from the media database.
179  * @details This function gets all media info handles meeting the given @a filter. The @a callback function will be invoked for every retrieved media info.
180  * If NULL is passed to the @a filter, no filtering is applied.
181  * @param[in] filter The handle to media info filter
182  * @param[in] callback The callback function to invoke
183  * @param[in] user_data The user data to be passed to the callback function
184  * @return 0 on success, otherwise a negative error value.
185  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
186  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
187  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
188  * @pre This function requires opened connection to content service by media_content_connect().
189  * @post This function invokes media_info_cb().
190  * @see media_content_connect()
191  * @see #media_info_cb
192  * @see media_info_filter_create()
193  *
194  */
195 int media_info_foreach_media_from_db(filter_h filter, media_info_cb callback, void *user_data);
196
197 /**
198  * @brief Gets the number of media tag for the passed @a filter in the given @a media ID from the media database.
199  *
200  * @param[in] media_id The ID of media info
201  * @param[in] filter The handle to media filter
202  * @param[out] tag_count The count of media tag
203  * @return 0 on success, otherwise a negative error value.
204  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
205  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
206  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
207  * @pre This function requires opened connection to content service by media_content_connect().
208  * @see media_content_connect()
209  *
210  */
211 int media_info_get_tag_count_from_db(const char *media_id, filter_h filter, int *tag_count);
212
213 /**
214  * @brief Iterates through the media tag in the given @a media @a info from the media database.
215  * @details This function gets all media tag associated with the given @a media and calls registered callback function for every retrieved media tag.
216  * @param[in] media_id The ID of media info
217  * @param[in] filter The handle to media filter
218  * @param[in] callback The callback function to invoke
219  * @param[in] user_data The user data to be passed to the callback function
220  * @return 0 on success, otherwise a negative error value.
221  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
222  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
223  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
224  * @pre This function requires opened connection to content service by media_content_connect().
225  * @post This function invokes media_tag_cb().
226  * @see media_content_connect()
227  * @see #media_tag_cb
228  */
229 int media_info_foreach_tag_from_db(const char *media_id, filter_h filter, media_tag_cb callback, void *user_data);
230
231 /**
232  * @brief Gets the number of bookmark for the passed @a filter in the given @a media ID from the media database.
233  *
234  * @param[in] media_id The ID of media info
235  * @param[in] filter The handle to media filter
236  * @param[out] bookmark_count The count of media tag
237  * @return 0 on success, otherwise a negative error value.
238  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
239  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
240  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
241  * @pre This function requires opened connection to content service by media_content_connect().
242  * @see media_content_connect()
243  *
244  */
245 int media_info_get_bookmark_count_from_db(const char *media_id, filter_h filter, int *bookmark_count);
246
247 /**
248  * @brief Iterates through the media bookmark in the given @a media @a info from the media database.
249  * @details This function gets all media bookmark associated with the given @a media and calls registered callback function for every retrieved media bookmark.
250  * @param[in] media_id The ID of media info
251  * @param[in] filter The handle to media filter
252  * @param[in] callback The callback function to invoke
253  * @param[in] user_data The user data to be passed to the callback function
254  * @return 0 on success, otherwise a negative error value.
255  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
256  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
257  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
258  * @pre This function requires opened connection to content service by media_content_connect().
259  * @post This function invokes media_bookmark_cb().
260  * @see media_content_connect()
261  * @see #media_bookmark_cb
262  */
263 int media_info_foreach_bookmark_from_db (const char *media_id, filter_h filter, media_bookmark_cb callback, void *user_data);
264
265 /**
266  * @brief Gets image metadata for a given media info.
267  * @details This function returns an image metadata handle retrieved from the media info.
268  *
269  * @remark The @a image handle must be released with image_meta_destroy() by you.
270  *
271  * @param [in] media The handle to media info
272  * @param[out] image A handle to image meta
273  * @return 0 on success, otherwise a negative error value.
274  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
275  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
276  * @see image_meta_destroy()
277  */
278 int media_info_get_image(media_info_h media, image_meta_h *image);
279
280 /**
281  * @brief Gets video metadata for a given media info.
282  * @details This function returns a video metadata handle retrieved from the media info handle.
283  *
284  * @remark The @a video handle must be released with video_meta_destroy() by you.
285  *
286  * @param [in] media The handle to media info
287  * @param[out] video A handle to the video meta
288  * @return 0 on success, otherwise a negative error value.
289  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
290  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
291  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
292  * @see video_meta_destroy()
293  *
294  */
295 int media_info_get_video(media_info_h media, video_meta_h *video);
296
297 /**
298  * @brief Gets audio metadata for a given media info.
299  * @details This function returns an audio metadata handle retrieved from the media info handle.
300  *
301  * @remark The @a audio handle must be released with audio_meta_destroy() by you.
302  *
303  * @param [in] media The handle to media info
304  * @param[out] audio A handle to the audio meta
305  * @return 0 on success, otherwise a negative error value.
306  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
307  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
308  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
309  * @see audio_meta_destroy()
310  */
311 int media_info_get_audio(media_info_h media, audio_meta_h *audio);
312
313 /**
314  * @brief Gets ID to media info.
315  *
316  *
317  * @param [in] media_id The ID if media info
318  * @param [out] media_id The ID of media tag
319  * @return 0 on success, otherwise a negative error value.
320  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
321  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
322  */
323 int media_info_get_media_id(media_info_h media, char **media_id);
324
325 /**
326  * @brief Gets path to media info.
327  *
328  * @remarks @a path must be released with free() by you.
329  *
330  * @param[in] media The handle to media info
331  * @param[out] path The path of media info
332  * @return 0 on success, otherwise a negative error value.
333  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
334  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
335  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
336  *
337  */
338 int media_info_get_file_path(media_info_h media, char **path);
339
340 /**
341  * @brief Gets name to media info.
342  *
343  * @remarks @a name must be released with free() by you.
344  *
345  * @param[in] media The handle to media info
346  * @param[out] name The name of media info
347  * @return 0 on success, otherwise a negative error value.
348  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
349  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
350  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
351  *
352  */
353 int media_info_get_display_name(media_info_h media, char **name);
354
355 /**
356  * @brief Gets media info's content type.
357  *
358  * @param[in] media The handle to media info
359  * @param[out] type The type of media content(#media_content_type_e)
360  * @return 0 on success, otherwise a negative error value.
361  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
362  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
363  *
364  */
365 int media_info_get_media_type(media_info_h media, media_content_type_e *type);
366
367 /**
368  * @brief Gets name to media info.
369  *
370  * @remarks @a mime_type must be released with free() by you.
371  *
372  * @param[in] media The handle to media info
373  * @param[out] mime_type The mime type of media info
374  * @return 0 on success, otherwise a negative error value.
375  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
376  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
377  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
378  *
379  */
380 int media_info_get_mime_type(media_info_h media, char **mime_type);
381
382 /**
383  * @brief Gets media file's size.
384  *
385  * @param[in] media The handle to media info
386  * @param[out] size The type of media content
387  * @return 0 on success, otherwise a negative error value.
388  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
389  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
390  *
391  */
392 int media_info_get_size(media_info_h media, unsigned long long *size);
393
394 /**
395  * @brief Gets added time.
396  *
397  * @param[in] media The handle to media info
398  * @param[out] added_time The added time to DB
399  * @return 0 on success, otherwise a negative error value.
400  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
401  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
402  *
403  */
404 int media_info_get_added_time(media_info_h media, time_t *added_time);
405
406 /**
407  * @brief Gets media info's date of modification.
408  *
409  * @param[in] media The handle to media info
410  * @param[out] time The date of modification of File. Get from File
411  * @return 0 on success, otherwise a negative error value.
412  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
413  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
414  *
415  */
416 int media_info_get_modified_time(media_info_h media, time_t *time);
417
418 /**
419  * @brief Gets the thumbnail to media info.
420  *
421  * @remarks @a path must be released with free() by you.
422  *
423  * @param[in] media The handle to media info
424  * @param[out] path The path to thumbnail of media info
425  * @return 0 on success, otherwise a negative error value.
426  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
427  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
428  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
429  *
430  */
431 int media_info_get_thumbnail_path(media_info_h media, char **path);
432
433 /**
434  * @brief Gets the description to media info.
435  *
436  * @remarks @a description must be released with free() by you.
437  *
438  * @param[in] media The handle to media info
439  * @param[out] description The description of media info
440  * @return 0 on success, otherwise a negative error value.
441  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
442  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
443  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
444  *
445  */
446 int media_info_get_description(media_info_h media, char **description);
447
448 /**
449  * @brief Gets media info's longitude.
450  *
451  * @param[in] media The handle to media info
452  * @param[out] longitude The longitude of media info
453  * @return 0 on success, otherwise a negative error value.
454  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
455  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
456  *
457  */
458 int media_info_get_longitude(media_info_h media, double* longitude);
459
460 /**
461  * @brief Gets media info's latitude.
462  *
463  * @param[in] media The handle to media info
464  * @param[out] latitude The latitude of media info
465  * @return 0 on success, otherwise a negative error value.
466  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
467  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
468  *
469  */
470 int media_info_get_latitude(media_info_h media, double* latitude);
471
472 /**
473  * @brief Gets media info's altitude of modification.
474  *
475  * @param[in] media The handle to media info
476  * @param[out] altitude The altitude of media info
477  * @return 0 on success, otherwise a negative error value.
478  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
479  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
480  *
481  */
482 int media_info_get_altitude(media_info_h media, double* altitude);
483
484 /**
485  * @brief Gets media info's rating.
486  *
487  * @param[in] media The handle to media info
488  * @param[out] rating The rating of media info
489  * @return 0 on success, otherwise a negative error value.
490  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
491  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
492  *
493  */
494 int media_info_get_rating(media_info_h media, int *rating);
495
496 /**
497  * @brief Gets the given media info's favorite status.
498  *
499  * @param [in] media The handle to media info
500  * @param [out] favorite The media favorite status(non zero if favorite, 0 if not favorite)
501  * @return 0 on success, otherwise a negative error value.
502  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
503  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
504  *
505  */
506 int media_info_get_favorite(media_info_h media, bool* favorite);
507
508 /**
509  * @brief Gets the author to media info.
510  *
511  * @remarks @a author must be released with free() by you.
512  *
513  * @param[in] media The handle to media info
514  * @param[out] author The author of media info
515  * @return 0 on success, 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
519  *
520  */
521 int media_info_get_author(media_info_h media, char **author);
522
523 /**
524  * @brief Gets the provider to media info.
525  *
526  * @remarks @a provider must be released with free() by you.
527  *
528  * @param[in] media The handle to media info
529  * @param[out] provider The provider of media info
530  * @return 0 on success, otherwise a negative error value.
531  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
532  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
533  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
534  *
535  */
536 int media_info_get_provider(media_info_h media, char **provider);
537
538 /**
539  * @brief Gets the content name to media info.
540  *
541  * @remarks @a content_name must be released with free() by you.
542  *
543  * @param[in] media The handle to media info
544  * @param[out] content_name The content name of media info
545  * @return 0 on success, otherwise a negative error value.
546  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
547  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
548  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
549  *
550  */
551 int media_info_get_content_name(media_info_h media, char **content_name);
552
553 /**
554  * @brief Gets the provider to media info.
555  *
556  * @remarks @a category must be released with free() by you.
557  *
558  * @param[in] media The handle to media info
559  * @param[out] category The category of media info
560  * @return 0 on success, otherwise a negative error value.
561  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
562  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
563  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
564  *
565  */
566 int media_info_get_category(media_info_h media, char **category);
567
568 /**
569  * @brief Gets the location_tag to media info.
570  *
571  * @remarks @a location_tag must be released with free() by you.
572  *
573  * @param[in] media The handle to media info
574  * @param[out] location_tag The location of media info
575  * @return 0 on success, otherwise a negative error value.
576  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
577  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
578  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
579  *
580  */
581 int media_info_get_location_tag(media_info_h media, char **location_tag);
582
583 /**
584  * @brief Gets the age_rating to media info.
585  *
586  * @remarks @a age_rating must be released with free() by you.
587  *
588  * @param[in] media The handle to media info
589  * @param[out] age_rating The age rating of media info
590  * @return 0 on success, otherwise a negative error value.
591  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
592  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
593  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
594  *
595  */
596 int media_info_get_age_rating(media_info_h media, char **age_rating);
597
598 /**
599  * @brief Gets the keyword to media info.
600  *
601  * @remarks @a keyword must be released with free() by you.
602  *
603  * @param[in] media The handle to media info
604  * @param[out] keyword The keyword of media info
605  * @return 0 on success, otherwise a negative error value.
606  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
607  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
608  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
609  *
610  */
611 int media_info_get_keyword(media_info_h media, char **keyword);
612
613 /**
614  * @brief Checks whether the media is protected via drm.
615  *
616  * @param[in] media The handle to media info
617  * @param[out] is_drm /@a true if the drm media,
618  *                    /@a false if not drm.
619  * @return 0 on success, otherwise a negative error value.
620  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
621  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
622  *
623  */
624 int media_info_is_drm(media_info_h media, bool *is_drm);
625
626 /**
627  * @brief Gets media info's storage_type.
628  *
629  * @param[in] media The handle to media info
630  * @param[out] storage_type The storage type of media info
631  * @return 0 on success, otherwise a negative error value.
632  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
633  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
634  *
635  */
636 int media_info_get_storage_type(media_info_h media, media_content_storage_e *storage_type);
637
638 /**
639  * @brief Gets the media info from the media database.
640  *
641  * @details This function creates a new media handle from the media database by the given media_id.
642  * media info will be created, which is filled with info information.
643  *
644  * @remarks @a media must be released with media_tag_destroy() by you.
645  *
646  * @param[in] media_id The ID of media info
647  * @param[out] media The media handle associated with the media ID
648  * @return 0 on success, otherwise a negative error value.
649  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
650  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
651  * @pre This function requires opened connection to content service by media_content_connect().
652  * @see media_content_connect()
653  * @see media_info_destroy()
654  *
655  */
656 int media_info_get_media_from_db(const char *media_id, media_info_h *media);
657
658 /**
659  * @brief Sets display name to media info.
660  *
661  * @param[in] media The handle to media info
662  * @param[in] display_name The display name of media info
663  * @return 0 on success, otherwise a negative error value.
664  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
665  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
666  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
667  * @post media_info_update_to_db()
668  *
669  */
670 int media_info_set_display_name(media_info_h media, const char *display_name);
671
672 /**
673  * @brief Sets description to media info.
674  *
675  * @param[in] media The handle to media info
676  * @param[in] description The description of media info
677  * @return 0 on success, otherwise a negative error value.
678  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
679  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
680  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
681  * @post media_info_update_to_db()
682  *
683  */
684 int media_info_set_description(media_info_h media, const char *description);
685
686 /**
687  * @brief Sets longitude to media info.
688  *
689  * @param[in] media The handle to media info
690  * @param[in] longitude The longitude of media info
691  * @return 0 on success, otherwise a negative error value.
692  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
693  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
694  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
695  * @post media_info_update_to_db()
696  *
697  */
698 int media_info_set_longitude(media_info_h media, double longitude);
699
700 /**
701  * @brief Sets latitude to media info.
702  *
703  * @param[in] media The handle to media info
704  * @param[in] latitude The latitude of media info
705  * @return 0 on success, otherwise a negative error value.
706  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
707  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
708  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
709  * @post media_info_update_to_db()
710  *
711  */
712 int media_info_set_latitude(media_info_h media, double latitude);
713
714 /**
715  * @brief Sets altitude to media info.
716  *
717  * @param[in] media The handle to media info
718  * @param[in] altitude The altitude of media info
719  * @return 0 on success, otherwise a negative error value.
720  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
721  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
722  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
723  * @post media_info_update_to_db()
724  *
725  */
726 int media_info_set_altitude(media_info_h media, double altitude);
727
728 /**
729  * @brief Sets rating to media info.
730  *
731  * @param[in] media The handle to media info
732  * @param[in] rating The rating of media info
733  * @return 0 on success, otherwise a negative error value.
734  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
735  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
736  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
737  * @post media_info_update_to_db()
738  *
739  */
740 int media_info_set_rating(media_info_h media, int rating);
741
742 /**
743  * @brief Sets favorite to media info.
744  *
745  * @param[in] media The handle to media info
746  * @param[in] favorite The favorite of media info
747  * @return 0 on success, otherwise a negative error value.
748  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
749  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
750  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
751  *
752  */
753 int media_info_set_favorite(media_info_h media, bool favorite);
754
755 /**
756  * @brief Sets author to media info.
757  *
758  * @param[in] media The handle to media info
759  * @param[in] author The author of media info
760  * @return 0 on success, otherwise a negative error value.
761  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
762  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
763  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
764  *
765  */
766 int media_info_set_author(media_info_h media, const char *author);
767
768 /**
769  * @brief Sets provider to media info.
770  *
771  * @param[in] media The handle to media info
772  * @param[in] provider The provider of media info
773  * @return 0 on success, otherwise a negative error value.
774  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
775  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
776  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
777  *
778  */
779 int media_info_set_provider(media_info_h media, const char *provider);
780
781 /**
782  * @brief Sets content name to media info.
783  *
784  * @param[in] media The handle to media info
785  * @param[in] content_name The content name of media info
786  * @return 0 on success, otherwise a negative error value.
787  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
788  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
789  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
790  * @post media_info_update_to_db()
791  *
792  */
793 int media_info_set_content_name(media_info_h media, const char *content_name);
794
795 /**
796  * @brief Sets category to media info.
797  *
798  * @param[in] media The handle to media info
799  * @param[in] category The category of media info
800  * @return 0 on success, otherwise a negative error value.
801  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
802  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
803  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
804  * @post media_info_update_to_db()
805  *
806  */
807 int media_info_set_category(media_info_h media, const char *category);
808
809 /**
810  * @brief Sets location tag to media info.
811  *
812  * @param[in] media The handle to media info
813  * @param[in] location_tag The location of media info
814  * @return 0 on success, otherwise a negative error value.
815  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
816  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
817  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
818  * @post media_info_update_to_db()
819  *
820  */
821 int media_info_set_location_tag(media_info_h media, const char *location_tag);
822
823 /**
824  * @brief Sets age rating to media info.
825  *
826  * @param[in] media The handle to media info
827  * @param[in] age_rating The age rating of media info
828  * @return 0 on success, otherwise a negative error value.
829  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
830  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
831  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
832  * @post media_info_update_to_db()
833  *
834  */
835 int media_info_set_age_rating(media_info_h media, const char *age_rating);
836
837 /**
838  * @brief Sets keyword to media info.
839  *
840  * @param[in] media The handle to media info
841  * @param[in] keyword The keyword of media info
842  * @return 0 on success, otherwise a negative error value.
843  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
844  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
845  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
846  * @post media_info_update_to_db()
847  *
848  */
849 int media_info_set_keyword(media_info_h media, const char *keyword);
850
851 /**
852  * @brief Updates the media info to the media database.
853  *
854  * @details The function updates the given media info in the media database. The function should be called after any change in media, to be updated to the media
855  * database. For example, after using media_info_set_display_name() for setting the name of the media, media_info_update_to_db() function should be called so as to update
856  * the given media info attibutes in the media database.
857  *
858  * @param[in] media The handle to media info
859  * @return 0 on success, otherwise a negative error value.
860  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
861  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
862  * @pre This function requires opened connection to content service by media_content_connect().
863  * @see media_content_connect()
864  * @see media_info_set_display_name()
865  * @see media_info_set_description()
866  * @see media_info_set_longitude()
867  * @see media_info_set_latitude()
868  * @see media_info_set_altitude()
869  * @see media_info_set_rating()
870  * @see media_info_set_favorite()
871  * @see media_info_set_author()
872  * @see media_info_set_provider()
873  * @see media_info_set_content_name()
874  * @see media_info_set_category()
875  * @see media_info_set_location_tag()
876  * @see media_info_set_age_rating()
877  *
878  */
879 int media_info_update_to_db(media_info_h media);
880
881 /**
882  * @brief Refresh the metadata of media to media database.
883  *
884  * @param[in] media_id The ID of media info
885  * @return 0 on success, otherwise a negative error value.
886  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
887  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
888  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
889  * @pre This function requires opened connection to content service by media_content_connect().
890  * @see media_content_connect()
891  *
892  */
893 int media_info_refresh_metadata_to_db(const char *media_id);
894
895 /**
896  * @brief Sets added_time to media info.
897  *
898  * @param[in] media The handle to media info
899  * @param[in] added_time The added time of media info
900  * @return 0 on success, otherwise a negative error value.
901  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
902  * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
903  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
904  * @post media_info_update_to_db()
905  *
906  */
907 int media_info_set_added_time(media_info_h media, time_t added_time);
908
909 /**
910  * @brief Moves the media info to the given destination path in the media database.
911  *
912  * @param[in] media The handle to media info
913  * @param[in] dst_path The path of destination
914  * @return 0 on success, otherwise a negative error value.
915  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
916  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
917  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
918  * @pre This function requires opened connection to content service by media_content_connect().
919  * @see media_content_connect()
920  *
921  */
922 int media_info_move_to_db(media_info_h media, const char* dst_path);
923
924 /**
925  * @brief Creates a thumbnail image for given the media, asynchronously.
926  * @details This function creates an thumbnail image for given media item and and calls registered callback function for completion of creating the thumbnail.
927  * If there already exist a thumbnail for given media, then the path of thumbnail will be return in callback function.
928  *
929  * @param[in] media The handle to media info
930  * @param[in] callback The callback function to invoke
931  * @param[in] user_data The user data to be passed to the callback function
932  * @return 0 on success, otherwise a negative error value.
933  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
934  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter ( Especially, if the request is duplicated, this error returns. )
935  * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
936  * @pre This function requires opened connection to content service by media_content_connect().
937  * @see media_content_connect()
938  */
939 int media_info_create_thumbnail(media_info_h media, media_thumbnail_completed_cb callback, void *user_data);
940
941
942 /**
943  * @brief Cancel to creates a thumbnail image for given the media.
944  *
945  * @param[in] media The handle to media info
946  * @return 0 on success, otherwise a negative error value.
947  * @retval #MEDIA_CONTENT_ERROR_NONE Successful
948  * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
949  * @pre This function requires opened connection to content service by media_content_connect().
950  * @see media_content_connect()
951  */
952 int media_info_cancel_thumbnail(media_info_h media);
953
954 /**
955  * @}
956  */
957
958
959 #ifdef __cplusplus
960 }
961 #endif /* __cplusplus */
962
963 #endif /* __TIZEN_MEDIA_INFORMATION_H__ */