Remove unused API & update description
[platform/core/api/media-content.git] / include / media_group.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 #ifndef __TIZEN_MEDIA_GROUP_H__
18 #define __TIZEN_MEDIA_GROUP_H__
19
20
21 #include <media_content_type.h>
22
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
27
28 /**
29  * @file media_group.h
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.
35  */
36
37 /**
38  * @addtogroup CAPI_CONTENT_MEDIA_ALBUM_MODULE
39  * @{
40  */
41
42 /**
43  * @brief Gets the number of the album for the passed @a filter from the media database.
44  * @since_tizen 2.3
45  *
46  * @param[in]  filter      The media filter handle
47  * @param[out] album_count The count of the media album
48  *
49  * @return @c 0 on success,
50  *         otherwise a negative error value
51  *
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
56  *
57  * @pre This function requires opened connection to content service by media_content_connect().
58  *
59  * @see media_content_connect()
60  */
61 int media_album_get_album_count_from_db(filter_h filter, int *album_count);
62
63 /**
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.
68  *
69  * @since_tizen 2.3
70  *
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
74  *
75  * @return @c 0 on success,
76  *         otherwise a negative error value
77  *
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
82  *
83  * @pre  This function requires opened connection to content service by media_content_connect().
84  * @post This function invokes media_album_cb().
85  *
86  * @see #media_album_cb
87  * @see media_content_connect()
88  * @see media_filter_create()
89  */
90 int media_album_foreach_album_from_db(filter_h filter, media_album_cb callback, void *user_data);
91
92 /**
93  * @brief Gets the number of media info for the given album present in the media database.
94  * @since_tizen 2.3
95  *
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
99  *
100  * @return @c 0 on success,
101  *         otherwise a negative error value
102  *
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
106  *
107  * @pre This function requires opened connection to content service by media_content_connect().
108  *
109  * @see media_content_connect()
110  */
111 int media_album_get_media_count_from_db (int album_id, filter_h filter, int *media_count);
112
113 /**
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.
118  *
119  * @since_tizen 2.3
120  *
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
125  *
126  * @return @c 0 on success,
127  *         otherwise a negative error value
128  *
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
132  *
133  * @pre  This function requires opened connection to content service by media_content_connect().
134  * @post This function invokes media_info_cb().
135  *
136  * @see #media_info_cb
137  * @see media_content_connect()
138  * @see media_filter_create()
139  */
140 int media_album_foreach_media_from_db(int album_id, filter_h filter, media_info_cb callback, void *user_data);
141
142 /**
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.
147  *
148  * @since_tizen 2.3
149  *
150  * @param[in] album The media album handle
151  *
152  * @return @c 0 on success,
153  *         otherwise a negative error value
154  *
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
158  *
159  * @pre Get copy of album handle by calling media_album_clone().
160  *
161  * @see media_album_clone()
162  */
163 int media_album_destroy(media_album_h album);
164
165 /**
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,
170  *          use this function.
171  *
172  * @since_tizen 2.3
173  *
174  * @remarks You must release the destination handle using media_album_destroy().
175  *
176  * @param[in]  src  The source handle to the media album
177  * @param[out] dst  The destination handle to the media album
178  *
179  * @return @c 0 on success,
180  *         otherwise a negative error value
181  *
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
186  *
187  * @see media_album_destroy()
188  * @see media_album_foreach_album_from_db()
189  */
190 int media_album_clone(media_album_h *dst, media_album_h src);
191
192 /**
193  * @brief Gets the ID of the album.
194  * @since_tizen 2.3
195  *
196  * @param[in]  album    The media album handle
197  * @param[out] album_id The media album ID
198  *
199  * @return @c 0 on success,
200  *         otherwise a negative error value
201  *
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
206  *
207  * @see media_album_foreach_album_from_db()
208  */
209 int media_album_get_album_id(media_album_h album, int *album_id);
210
211 /**
212  * @brief Gets the name of the album.
213  * @since_tizen 2.3
214  *
215  * @remarks You must release @a album_name using free().
216  *
217  * @param[in]  album       The media album handle
218  * @param[out] album_name  The name of the media album handle
219  *
220  * @return @c 0 on success,
221  *         otherwise a negative error value
222  *
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
227  */
228 int media_album_get_name(media_album_h album, char **album_name);
229
230 /**
231  * @brief Gets the name of the artist from the given album.
232  * @since_tizen 2.3
233  *
234  * @remarks You must release @a artist using free().
235  *
236  * @param[in]  album  The media album handle
237  * @param[out] artist The name of the media artist
238  *
239  * @return @c 0 on success,
240  *         otherwise a negative error value
241  *
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
246  */
247 int media_album_get_artist(media_album_h album, char **artist);
248
249 /**
250  * @brief Gets the album art path from the album.
251  * @since_tizen 2.3
252  *
253  * @remarks You must release @a album_art using free().
254  *
255  * @param[in]  album     The media album handle
256  * @param[out] album_art The path of the media album_art
257  *
258  * @return @c 0 on success,
259  *         otherwise a negative error value
260  *
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
265  */
266 int media_album_get_album_art(media_album_h album, char **album_art);
267
268 /**
269  * @brief Gets the media album from the media database.
270  *
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.
273  *
274  * @since_tizen 2.3
275  *
276  * @remarks You must release @a folder using media_album_destroy().
277  *
278  * @param[in]  album_id The ID of the media album
279  * @param[out] album    The album handle associated with the album ID
280  *
281  * @return @c 0 on success,
282  *         otherwise a negative error value
283  *
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
287  *
288  * @pre This function requires opened connection to content service by media_content_connect().
289  *
290  * @see media_content_connect()
291  * @see media_album_destroy()
292  */
293 int media_album_get_album_from_db(int album_id, media_album_h *album);
294
295
296 /**
297  * @}
298  */
299
300
301 /**
302 * @addtogroup CAPI_CONTENT_MEDIA_GROUP_MODULE
303 * @{
304 */
305
306  /**
307  * @brief Gets the number of the group for the passed @a filter from the media database.
308  * @since_tizen 2.3
309  *
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
313  *
314  * @return @c 0 on success,
315  *         otherwise a negative error value
316  *
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
320  *
321  * @pre This function requires opened connection to content service by media_content_connect().
322  *
323  * @see media_content_connect()
324  */
325 int media_group_get_group_count_from_db(filter_h filter, media_group_e group, int *group_count);
326
327  /**
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.
332  *
333  * @since_tizen 2.3
334  *
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
339  *
340  * @return @c 0 on success,
341  *         otherwise a negative error value
342  *
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
346  *
347  * @pre  This function requires opened connection to content service by media_content_connect().
348  * @post This function invokes media_group_cb().
349  *
350  * @see #media_group_cb
351  * @see media_content_connect()
352  * @see media_filter_create()
353  */
354 int media_group_foreach_group_from_db(filter_h filter, media_group_e group, media_group_cb callback, void *user_data);
355
356  /**
357  * @brief Gets the count of the media info for the given media group present in the media database.
358  * @since_tizen 2.3
359  *
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
364  *
365  * @return @c 0 on success,
366  *         otherwise a negative error value
367  *
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
371  *
372  * @pre This function requires opened connection to content service by media_content_connect().
373  *
374  * @see media_content_connect()
375  */
376 int media_group_get_media_count_from_db(const char *group_name, media_group_e group, filter_h filter, int *media_count);
377
378  /**
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.
383  *
384  * @since_tizen 2.3
385  *
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
391  *
392  * @return @c 0 on success,
393  *         otherwise a negative error value
394  *
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
398  *
399  * @pre  This function requires opened connection to content service by media_content_connect().
400  * @post This function invokes media_info_cb().
401  *
402  * @see media_info_cb()
403  * @see media_content_connect()
404  * @see media_filter_create()
405  */
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);
407
408  /**
409   * @}
410   */
411
412 #ifdef __cplusplus
413  }
414 #endif /* __cplusplus */
415
416 #endif /* __TIZEN_MEDIA_GROUP_H__ */