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_MEDIA_INFORMATION_H__
19 #define __TIZEN_MEDIA_INFORMATION_H__
21 #include <media_content_type.h>
27 #endif /* __cplusplus */
31 * @addtogroup CAPI_CONTENT_MEDIA_INFO_MODULE
36 * @brief Iterates through media info from the media database.
37 * @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.
38 * If NULL is passed to the @a filter, no filtering is applied.
39 * @param[in] filter The handle to media info filter
40 * @param[in] callback The callback function to invoke
41 * @param[in] user_data The user data to be passed to the callback function
42 * @return 0 on success, otherwise a negative error value.
43 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
44 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
45 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
46 * @pre This function requires opened connection to content service by media_content_connect().
47 * @post This function invokes media_info_cb().
48 * @see media_content_connect()
50 * @see media_info_filter_create()
53 int media_info_foreach_media_from_db(media_info_filter_h filter, media_info_cb callback, void *user_data);
58 * @brief Iterates through the media tag in the given @a media @a info from the media database.
59 * @details This function gets all media tag associated with the given @a media and calls registered callback function for every retrieved media tag.
60 * @param[in] media The handle to media info
61 * @param[in] callback The callback function to invoke
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_OUT_OF_MEMORY Out of memory
66 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
67 * @pre This function requires opened connection to content service by media_content_connect().
68 * @post This function invokes media_tag_cb().
69 * @see media_content_connect()
72 int media_info_foreach_tag_from_db(media_info_h media, media_tag_cb callback, void *user_data);
77 * @brief Clones the media info handle.
79 * @details This function copies the media info handle from a source to destination.
80 * There is no media_info_create() function. The media_info_h is created internally and
81 * available through media info foreach function such as media_info_foreach_media_from_db().
82 * To use this handle outside of these foreach functions, use this function.
83 * @remark The destination handle must be released with media_info_destroy() by you.
85 * @param[out] dst A destination handle to media info
86 * @param[in] src The source handle to media info
87 * @return 0 on success, otherwise a negative error value.
88 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
89 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
90 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
91 * @see media_info_destroy()
92 * @see audio_album_foreach_media_from_db()
93 * @see audio_playlist_foreach_media_from_db()
94 * @see audio_artist_foreach_media_from_db()
95 * @see audio_author_foreach_media_from_db()
96 * @see audio_genre_get_media_count_from_db()
97 * @see media_tag_foreach_media_from_db()
98 * @see media_info_foreach_media_from_db()
99 * @see media_folder_foreach_media_from_db()
102 int media_info_clone(media_info_h* dst, media_info_h src);
106 * @brief Destroys the media info.
107 * @details The function frees all resources related to the media info handle. This handle
108 * no longer can be used to perform any operation. New media info handle has to
109 * be created before next usage.
111 * @param[in] media The handle to media info
112 * @return 0 on success, otherwise a negative error value.
113 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
114 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
115 * @pre Get copy of media_info handle by calling media_info_clone()
116 * @see media_info_clone()
118 int media_info_destroy(media_info_h media);
123 * @brief Gets path to media info.
125 * @remarks @a path must be released with free() by you.
127 * @param[in] media The handle to media info
128 * @param[out] path The path of media info
129 * @return 0 on success, otherwise a negative error value.
130 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
131 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
132 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
135 int media_info_get_file_path(media_info_h media, char **path);
138 * @brief Gets name to media info.
140 * @remarks @a name must be released with free() by you.
142 * @param[in] media The handle to media info
143 * @param[out] name The name of media info
144 * @return 0 on success, otherwise a negative error value.
145 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
146 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
147 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
150 int media_info_get_display_name(media_info_h media, char **name);
153 * @brief Gets the thumbnail to media info.
155 * @remarks @a path must be released with free() by you.
157 * @param[in] media The handle to media info
158 * @param[out] path The path to thumbnail of media info
159 * @return 0 on success, otherwise a negative error value.
160 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
161 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
162 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
165 int media_info_get_thumbnail_path(media_info_h media, char **path);
168 * @brief Gets media info's date of modification.
170 * @param[in] media The handle to media info
171 * @param[out] time The date of modification
172 * @return 0 on success, otherwise a negative error value.
173 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
174 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
177 int media_info_get_date_modified(media_info_h media, time_t *time);
180 * @brief Gets media info's content type.
182 * @param[in] media The handle to media info
183 * @param[out] type The type of media content(#media_content_type_e). \n
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
189 int media_info_get_media_type(media_info_h media, int *type);
194 * @brief Gets image metadata for a given media info from the media database.
195 * @details This function returns an image metadata handle retrieved from the media info.
197 * @remark The @a image handle must be released with image_meta_destroy() by you.
199 * @param[in] media The handle to media info
200 * @param[out] image A handle to image meta
201 * @return 0 on success, otherwise a negative error value.
202 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
203 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
204 * @pre This function requires opened connection to content service by media_content_connect().
205 * @see media_content_connect()
206 * @see image_meta_destroy()
208 int media_info_get_image_from_db(media_info_h media, image_meta_h* image);
211 * @brief Gets video metadata for a given media info from the media database.
212 * @details This function returns a video metadata handle retrieved from the media info handle.
214 * @remark The @a video handle must be released with video_meta_destroy() by you.
216 * @param[in] media The handle to media info
217 * @param[out] video A handle to the video meta
218 * @return 0 on success, otherwise a negative error value.
219 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
220 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
221 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
222 * @pre This function requires opened connection to content service by media_content_connect().
223 * @see media_content_connect()
224 * @see video_meta_destroy()
227 int media_info_get_video_from_db(media_info_h media, video_meta_h* video);
230 * @brief Gets audio metadata for a given media info from the media database.
231 * @details This function returns an audio metadata handle retrieved from the media info handle.
233 * @remark The @a audio handle must be released with audio_meta_destroy() by you.
235 * @param[in] media The handle to media info
236 * @param[out] audio A handle to the audio meta
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_OUT_OF_MEMORY Out of memory
241 * @pre This function requires opened connection to content service by media_content_connect().
242 * @see media_content_connect()
243 * @see audio_meta_destroy()
245 int media_info_get_audio_from_db(media_info_h media, audio_meta_h* audio);
249 * @brief Gets the given media info's favorite status.
251 * @param [in] media The handle to media info
252 * @param [out] favorite The media favorite status(non zero if favorite, 0 if not favorite)
253 * @return 0 on success, otherwise a negative error value.
254 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
255 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
258 int media_info_get_favorite(media_info_h media, int* favorite);
262 * @brief Updates media info's favorite status to the media database.
264 * @param [in] media The handle to media info
265 * @param [in] favorite The media favorite status(non zero if favorite, 0 if not favorite)
266 * @return 0 on success, otherwise a negative error value.
267 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
268 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
269 * @pre This function requires opened connection to content service by media_content_connect().
270 * @see media_content_connect()
271 * @see media_info_meta_get_favorite()
273 int media_info_update_favorite_to_db(media_info_h media, int favorite);
278 * @brief Inserts media file into the media database.
279 * @details This function inserts an media item with desired @a type into the content storage.
280 * Normally, inserting a media file in database is done automatically by media server, without calling this function.
281 * This function is only called when media server is busy and user needs to get quick result of inserting
282 * e.g. Taking a photo while media server is busy and user want to see the quick snapshot of the photo taken.
284 * @param[in] type The type of media content
285 * @param[in] path The path to the media file
286 * @return 0 on success, otherwise a negative error value.
287 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
288 * @pre This function requires opened connection to content service by media_content_connect().
289 * @see #media_content_type_e media_content_connect()
291 int media_info_insert_to_db(media_content_type_e type, const char *path);
303 #endif /* __cplusplus */
305 #endif /* __TIZEN_MEDIA_INFORMATION_H__ */