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.
44 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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_DB_BUSY DB Operation busy
56 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
58 * @pre This function requires opened connection to content service by media_content_connect().
60 * @see media_content_connect()
62 int media_album_get_album_count_from_db(filter_h filter, int *album_count);
65 * @brief Iterates through the media album with optional @a filter from the media database.
66 * @details This function gets all media album handles meeting the given filter.
67 * The callback function will be invoked for every retrieved media album.
68 * If @c NULL is passed to the filter, no filtering is applied.
70 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72 * @param[in] filter The media filter handle
73 * @param[in] callback The callback function to be invoked
74 * @param[in] user_data The user data to be passed to the callback function
76 * @return @c 0 on success,
77 * otherwise a negative error value
79 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
80 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
81 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
82 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
83 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
84 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
86 * @pre This function requires opened connection to content service by media_content_connect().
87 * @post This function invokes media_album_cb().
89 * @see #media_album_cb
90 * @see media_content_connect()
91 * @see media_filter_create()
93 int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback, void *user_data);
96 * @brief Gets the number of media info for the given album present in the media database.
97 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
99 * @param[in] album_id The ID of the media album
100 * @param[in] filter The media filter handle
101 * @param[out] media_count The count of the album
103 * @return @c 0 on success,
104 * otherwise a negative error value
106 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
107 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
108 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
109 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
110 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
113 * @pre This function requires opened connection to content service by media_content_connect().
115 * @see media_content_connect()
117 int media_album_get_media_count_from_db(int album_id, filter_h filter, int *media_count);
120 * @brief Iterates through the media files with an optional @a filter in the given media album from the media database.
121 * @details This function gets all media files associated with the given media album and
122 * meeting desired filter option and calls @a callback for
123 * every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
125 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
127 * @param[in] album_id The ID of the media album
128 * @param[in] filter The media filter handle
129 * @param[in] callback The callback function to be invoked
130 * @param[in] user_data The user data to be passed to the callback function
132 * @return @c 0 on success,
133 * otherwise a negative error value
135 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
136 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
137 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
138 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
139 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
140 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
142 * @pre This function requires opened connection to content service by media_content_connect().
143 * @post This function invokes media_info_cb().
145 * @see #media_info_cb
146 * @see media_content_connect()
147 * @see media_filter_create()
149 int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_cb callback, void *user_data);
152 * @brief Destroys the album handle.
153 * @details This function frees all resources related to the album handle. This handle
154 * can no longer be used to perform any operation. A new handle has to
155 * be created before the next use.
157 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
159 * @param[in] album The media album handle
161 * @return @c 0 on success,
162 * otherwise a negative error value
164 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
165 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
167 * @pre Get copy of album handle by calling media_album_clone().
169 * @see media_album_clone()
171 int media_album_destroy(media_album_h album);
174 * @brief Clones a media album.
175 * @details This function copies the media album handle from a source to
176 * destination. There is no media_album_create() function. The media_album_h is created internally and available through
177 * media album foreach function such as media_album_foreach_album_from_db(). To use this handle outside of these foreach functions,
180 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
182 * @remarks You must release the destination handle using media_album_destroy().
184 * @param[in] src The source handle to the media album
185 * @param[out] dst The destination handle to the media album
187 * @return @c 0 on success,
188 * otherwise a negative error value
190 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
191 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
192 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
194 * @see media_album_destroy()
195 * @see media_album_foreach_album_from_db()
197 int media_album_clone(media_album_h *dst, media_album_h src);
200 * @brief Gets the ID of the album.
201 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
203 * @param[in] album The media album handle
204 * @param[out] album_id The media album ID
206 * @return @c 0 on success,
207 * otherwise a negative error value
209 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
210 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
212 * @see media_album_foreach_album_from_db()
214 int media_album_get_album_id(media_album_h album, int *album_id);
217 * @brief Gets the name of the album.
218 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
220 * @remarks You must release @a album_name using free().
222 * @param[in] album The media album handle
223 * @param[out] album_name The name of the media album handle
225 * @return @c 0 on success,
226 * otherwise a negative error value
228 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
229 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
230 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
232 int media_album_get_name(media_album_h album, char **album_name);
235 * @brief Gets the name of the artist from the given album.
236 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
238 * @remarks You must release @a artist using free().
240 * @param[in] album The media album handle
241 * @param[out] artist The name of the media artist
243 * @return @c 0 on success,
244 * otherwise a negative error value
246 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
247 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
248 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
250 int media_album_get_artist(media_album_h album, char **artist);
253 * @brief Gets the album art path from the album.
254 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256 * @remarks You must release @a album_art using free().
258 * @param[in] album The media album handle
259 * @param[out] album_art The path of the media album_art
261 * @return @c 0 on success,
262 * otherwise a negative error value
264 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
265 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
266 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
268 int media_album_get_album_art(media_album_h album, char **album_art);
271 * @brief Gets the media album from the media database.
273 * @details This function creates a new media album handle from the media database by the given @a album_id.
274 * Media album will be created and will be filled with the album information.
276 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
278 * @remarks You must release @a folder using media_album_destroy().
280 * @param[in] album_id The ID of the media album
281 * @param[out] album The album handle associated with the album ID
283 * @return @c 0 on success,
284 * otherwise a negative error value
286 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
287 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
288 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
289 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
290 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
291 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
293 * @pre This function requires opened connection to content service by media_content_connect().
295 * @see media_content_connect()
296 * @see media_album_destroy()
298 int media_album_get_album_from_db(int album_id, media_album_h *album);
307 * @addtogroup CAPI_CONTENT_MEDIA_GROUP_MODULE
312 * @brief Gets the number of the group for the passed @a filter from the media database.
313 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
315 * @param[in] filter The media filter handle
316 * @param[in] group The type of the media group
317 * @param[out] group_count The count of the media group
319 * @return @c 0 on success,
320 * otherwise a negative error value
322 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
323 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
324 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
325 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
326 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
328 * @pre This function requires opened connection to content service by media_content_connect().
330 * @see media_content_connect()
332 int media_group_get_group_count_from_db(filter_h filter, media_group_e group, int *group_count);
335 * @brief Iterates through the media group with an optional @a filter from the media database.
336 * @details This function gets names of media group meeting the given filter.
337 * The callback function will be invoked for every retrieved media group.
338 * If @c NULL is passed to the filter, no filtering is applied.
340 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
342 * @param[in] filter The media filter handle
343 * @param[in] group The type of the media group
344 * @param[in] callback The callback function to be invoked
345 * @param[in] user_data The user data to be passed to the callback function
347 * @return @c 0 on success,
348 * otherwise a negative error value
350 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
351 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
352 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
353 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
354 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
355 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
357 * @pre This function requires opened connection to content service by media_content_connect().
358 * @post This function invokes media_group_cb().
360 * @see #media_group_cb
361 * @see media_content_connect()
362 * @see media_filter_create()
364 int media_group_foreach_group_from_db(filter_h filter, media_group_e group, media_group_cb callback, void *user_data);
367 * @brief Gets the count of the media info for the given media group present in the media database.
368 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
370 * @param[in] group_name The name of the media group
371 * @param[in] group The type of the media group
372 * @param[in] filter The media filter handle
373 * @param[out] media_count The count of the media
375 * @return @c 0 on success,
376 * otherwise a negative error value
378 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
379 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
380 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
381 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
382 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
383 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
385 * @pre This function requires opened connection to content service by media_content_connect().
387 * @see media_content_connect()
389 int media_group_get_media_count_from_db(const char *group_name, media_group_e group, filter_h filter, int *media_count);
392 * @brief Iterates through the media files with an optional @a filter in the given @a group from the media database.
393 * @details This function gets all media files associated with the given group and
394 * meeting desired filter option and calls @a callback for
395 * every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
397 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
399 * @param[in] group_name The name of the media group
400 * @param[in] group The type of the media group
401 * @param[in] filter The media filter handle
402 * @param[in] callback The callback function to be invoked
403 * @param[in] user_data The user data to be passed to the callback function
405 * @return @c 0 on success,
406 * otherwise a negative error value
408 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
409 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
410 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
411 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
412 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
413 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
415 * @pre This function requires opened connection to content service by media_content_connect().
416 * @post This function invokes media_info_cb().
418 * @see media_info_cb()
419 * @see media_content_connect()
420 * @see media_filter_create()
422 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);
430 #endif /* __cplusplus */
432 #endif /* __TIZEN_MEDIA_GROUP_H__ */