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.
17 #ifndef __TIZEN_MEDIA_GROUP_H__
18 #define __TIZEN_MEDIA_GROUP_H__
21 #include <media_content_type.h>
26 #endif /* __cplusplus */
30 * @brief This file contains API related to handling different operations with album and other media data groups in DB.
31 * The following APIs are capable to get number of albums, media info in the given album from DB, \n
32 * to clone, destroy and get all albums and media files associated with the given media album from DB, \n
33 * to get name, ID, artist, album art path from album; to get number of groups and their names, \n
34 * to get the number of media files and their content associated with the given group from DB.
38 * @addtogroup CAPI_CONTENT_MEDIA_ALBUM_MODULE
43 * @brief Gets the number of the album for the passed @a filter from the media database.
46 * @param[in] filter The media filter handle
47 * @param[out] album_count The count of the media album
49 * @return @c 0 on success,
50 * otherwise a negative error value
52 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
53 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
54 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
55 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
57 * @pre This function requires opened connection to content service by media_content_connect().
59 * @see media_content_connect()
61 int media_album_get_album_count_from_db(filter_h filter, int *album_count);
64 * @brief Iterates through the media album with optional @a filter from the media database.
65 * @details This function gets all media album handles meeting the given filter.
66 * The callback function will be invoked for every retrieved media album.
67 * If @c NULL is passed to the filter, no filtering is applied.
71 * @param[in] filter The media filter handle
72 * @param[in] callback The callback function to be invoked
73 * @param[in] user_data The user data to be passed to the callback function
75 * @return @c 0 on success,
76 * otherwise a negative error value
78 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
79 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
80 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
81 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
83 * @pre This function requires opened connection to content service by media_content_connect().
84 * @post This function invokes media_album_cb().
86 * @see #media_album_cb
87 * @see media_content_connect()
88 * @see media_filter_create()
90 int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback, void *user_data);
93 * @brief Gets the number of media info for the given album present in the media database.
96 * @param[in] album_id The ID of the media album
97 * @param[in] filter The media filter handle
98 * @param[out] media_count The count of the album
100 * @return @c 0 on success,
101 * otherwise a negative error value
103 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
104 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
105 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
107 * @pre This function requires opened connection to content service by media_content_connect().
109 * @see media_content_connect()
111 int media_album_get_media_count_from_db (int album_id, filter_h filter, int *media_count);
114 * @brief Iterates through the media files with an optional @a filter in the given media album from the media database.
115 * @details This function gets all media files associated with the given media album and
116 * meeting desired filter option and calls registered callback function for
117 * every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
121 * @param[in] album_id The ID of the media album
122 * @param[in] filter The media filter handle
123 * @param[in] callback The callback function to be invoked
124 * @param[in] user_data The user data to be passed to the callback function
126 * @return @c 0 on success,
127 * otherwise a negative error value
129 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
130 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
131 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
133 * @pre This function requires opened connection to content service by media_content_connect().
134 * @post This function invokes media_info_cb().
136 * @see #media_info_cb
137 * @see media_content_connect()
138 * @see media_filter_create()
140 int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_cb callback, void *user_data);
143 * @brief Destroys the album handle.
144 * @details This function frees all resources related to the album handle. This handle
145 * can no longer be used to perform any operation. A new handle has to
146 * be created before the next use.
150 * @param[in] album The media album handle
152 * @return @c 0 on success,
153 * otherwise a negative error value
155 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
156 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
157 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
159 * @pre Get copy of album handle by calling media_album_clone().
161 * @see media_album_clone()
163 int media_album_destroy(media_album_h album);
166 * @brief Clones a media album.
167 * @details This function copies the media album handle from a source to
168 * destination. There is no media_album_create() function. The media_album_h is created internally and available through
169 * media album foreach function such as media_album_foreach_album_from_db(). To use this handle outside of these foreach functions,
174 * @remarks You must release the destination handle using media_album_destroy().
176 * @param[in] src The source handle to the media album
177 * @param[out] dst The destination handle to the media album
179 * @return @c 0 on success,
180 * otherwise a negative error value
182 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
183 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
184 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
185 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
187 * @see media_album_destroy()
188 * @see media_album_foreach_album_from_db()
190 int media_album_clone(media_album_h *dst, media_album_h src);
193 * @brief Gets the ID of the album.
196 * @param[in] album The media album handle
197 * @param[out] album_id The media album ID
199 * @return @c 0 on success,
200 * otherwise a negative error value
202 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
203 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
204 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
205 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
207 * @see media_album_foreach_album_from_db()
209 int media_album_get_album_id(media_album_h album, int *album_id);
212 * @brief Gets the name of the album.
215 * @remarks You must release @a album_name using free().
217 * @param[in] album The media album handle
218 * @param[out] album_name The name of the media album handle
220 * @return @c 0 on success,
221 * otherwise a negative error value
223 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
224 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
225 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
226 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
228 int media_album_get_name(media_album_h album, char **album_name);
231 * @brief Gets the name of the artist from the given album.
234 * @remarks You must release @a artist using free().
236 * @param[in] album The media album handle
237 * @param[out] artist The name of the media artist
239 * @return @c 0 on success,
240 * otherwise a negative error value
242 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
243 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
244 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
245 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
247 int media_album_get_artist(media_album_h album, char **artist);
250 * @brief Gets the album art path from the album.
253 * @remarks You must release @a album_art using free().
255 * @param[in] album The media album handle
256 * @param[out] album_art The path of the media album_art
258 * @return @c 0 on success,
259 * otherwise a negative error value
261 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
262 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
263 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
264 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
266 int media_album_get_album_art(media_album_h album, char **album_art);
269 * @brief Gets the media album from the media database.
271 * @details This function creates a new media album handle from the media database by the given @a album_id.
272 * Media album will be created and will be filled with the album information.
276 * @remarks You must release @a folder using media_album_destroy().
278 * @param[in] album_id The ID of the media album
279 * @param[out] album The album handle associated with the album ID
281 * @return @c 0 on success,
282 * otherwise a negative error value
284 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
285 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
286 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
288 * @pre This function requires opened connection to content service by media_content_connect().
290 * @see media_content_connect()
291 * @see media_album_destroy()
293 int media_album_get_album_from_db(int album_id, media_album_h *album);
302 * @addtogroup CAPI_CONTENT_MEDIA_GROUP_MODULE
307 * @brief Gets the number of the group for the passed @a filter from the media database.
310 * @param[in] filter The media filter handle
311 * @param[in] group The type of the media group
312 * @param[out] group_count The count of the media group
314 * @return @c 0 on success,
315 * otherwise a negative error value
317 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
318 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
319 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB operation failed
321 * @pre This function requires opened connection to content service by media_content_connect().
323 * @see media_content_connect()
325 int media_group_get_group_count_from_db(filter_h filter, media_group_e group, int *group_count);
328 * @brief Iterates through the media group with an optional @a filter from the media database.
329 * @details This function gets names of media group meeting the given filter.
330 * The callback function will be invoked for every retrieved media group.
331 * If @c NULL is passed to the filter, no filtering is applied.
335 * @param[in] filter The media filter handle
336 * @param[in] group The type of the media group
337 * @param[in] callback The callback function to be invoked
338 * @param[in] user_data The user data to be passed to the callback function
340 * @return @c 0 on success,
341 * otherwise a negative error value
343 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
344 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
345 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
347 * @pre This function requires opened connection to content service by media_content_connect().
348 * @post This function invokes media_group_cb().
350 * @see #media_group_cb
351 * @see media_content_connect()
352 * @see media_filter_create()
354 int media_group_foreach_group_from_db(filter_h filter, media_group_e group, media_group_cb callback, void *user_data);
357 * @brief Gets the count of the media info for the given media group present in the media database.
360 * @param[in] group_name The name of the media group
361 * @param[in] group The type of the media group
362 * @param[in] filter The media filter handle
363 * @param[out] media_count The count of the media
365 * @return @c 0 on success,
366 * otherwise a negative error value
368 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
369 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
370 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
372 * @pre This function requires opened connection to content service by media_content_connect().
374 * @see media_content_connect()
376 int media_group_get_media_count_from_db(const char *group_name, media_group_e group, filter_h filter, int *media_count);
379 * @brief Iterates through the media files with an optional @a filter in the given @a group from the media database.
380 * @details This function gets all media files associated with the given group and
381 * meeting desired filter option and calls registered callback function for
382 * every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
386 * @param[in] group_name The name of the media group
387 * @param[in] group The type of the media group
388 * @param[in] filter The media filter handle
389 * @param[in] callback The callback function to be invoked
390 * @param[in] user_data The user data to be passed to the callback function
392 * @return @c 0 on success,
393 * otherwise a negative error value
395 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
396 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
397 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
399 * @pre This function requires opened connection to content service by media_content_connect().
400 * @post This function invokes media_info_cb().
402 * @see media_info_cb()
403 * @see media_content_connect()
404 * @see media_filter_create()
406 int media_group_foreach_media_from_db(const char *group_name, media_group_e group, filter_h filter, media_info_cb callback, void *user_data);
414 #endif /* __cplusplus */
416 #endif /* __TIZEN_MEDIA_GROUP_H__ */