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_CONTENT_MEDIA_PLAYLIST_H__
18 #define __TIZEN_CONTENT_MEDIA_PLAYLIST_H__
20 #include <media_content_type.h>
24 #endif /* __cplusplus */
28 * @brief This file contains the playlist API and functions related with handling playlists. \n
29 * Functions include operations to get the number of playlists, the number of media-info for the playlist \n
30 * and all media files in the playlist, to clone, destroy, insert and delete playlist from DB, \n
31 * to handle with name, ID, thumbnail, played order and media info of the playlist.
35 * @addtogroup CAPI_CONTENT_MEDIA_PLAYLIST_MODULE
41 * @deprecated Deprecated since 9.0.
42 * @brief Gets the number of playlists for the passed @a filter from the media database.
45 * @param[in] filter The handle to the media filter
46 * @param[out] playlist_count The count of the media playlist
48 * @return @c 0 on success,
49 * otherwise a negative error value
51 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
52 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
53 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
54 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
56 * @pre This function requires opened connection to content service by media_content_connect().
58 * @see media_content_connect()
60 int media_playlist_get_playlist_count_from_db(filter_h filter, int *playlist_count) TIZEN_DEPRECATED_API;
63 * @deprecated Deprecated since 9.0.
64 * @brief Iterates through the media playlists with an optional @a filter from the media database.
65 * @details This function gets all media playlists meeting the given filter.
66 * The callback function will be invoked for every retrieved media playlist.
67 * If @c NULL is passed to the filter, no filtering is applied.
71 * @param[in] filter The handle to the media filter
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_DB_FAILED DB Operation failed
82 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
84 * @pre This function requires opened connection to content service by media_content_connect().
85 * @post This function invokes media_playlist_cb().
87 * @see media_playlist_cb()
88 * @see media_content_connect()
89 * @see media_filter_create()
91 int media_playlist_foreach_playlist_from_db(filter_h filter, media_playlist_cb callback, void *user_data) TIZEN_DEPRECATED_API;
94 * @deprecated Deprecated since 9.0.
95 * @brief Gets the number of the media info for the given playlist present in the media database.
98 * @param[in] playlist_id The ID of the media playlist
99 * @param[in] filter The handle to the media filter
100 * @param[out] media_count The number of media items
102 * @return @c 0 on success,
103 * otherwise a negative error value
105 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
106 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
107 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
108 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
110 * @pre This function requires opened connection to content service by media_content_connect().
112 * @see media_content_connect()
114 int media_playlist_get_media_count_from_db(int playlist_id, filter_h filter, int *media_count) TIZEN_DEPRECATED_API;
117 * @deprecated Deprecated since 9.0.
118 * @brief Iterates through the media files with an optional @a filter in the given audio playlist from the media database.
119 * @details This function gets all media files associated with the given media playlist and
120 * meeting desired filter option and calls @a callback for
121 * every retrieved media info. If @c NULL is passed to the @a filter, no filtering is applied.
125 * @param[in] playlist_id The ID of the media playlist
126 * @param[in] filter The handle to the media filter
127 * @param[in] callback The callback function to be invoked
128 * @param[in] user_data The user data to be passed to the callback function
130 * @return @c 0 on success,
131 * otherwise a negative error value
133 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
134 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
135 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
136 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
137 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
139 * @pre This function requires opened connection to content service by media_content_connect().
140 * @post This function invokes media_info_cb().
142 * @see media_info_cb()
143 * @see media_content_connect()
144 * @see media_filter_create()
146 int media_playlist_foreach_media_from_db(int playlist_id, filter_h filter, playlist_member_cb callback, void *user_data) TIZEN_DEPRECATED_API;
149 * @deprecated Deprecated since 9.0.
150 * @brief Inserts a new playlist with the given name into the media database.
154 * @privilege %http://tizen.org/privilege/content.write
156 * @remarks The @a playlist should be released using media_playlist_destroy().
158 * @param[in] name The name of the inserted playlist
159 * @param[out] playlist The handle to the media playlist
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
166 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
167 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
168 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
169 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
170 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
171 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
173 * @pre This function requires opened connection to content service by media_content_connect().
175 * @see media_content_connect()
176 * @see media_playlist_delete_from_db()
178 int media_playlist_insert_to_db(const char *name, media_playlist_h *playlist) TIZEN_DEPRECATED_API;
181 * @deprecated Deprecated since 9.0.
182 * @brief Deletes the given playlist from the media database.
186 * @privilege %http://tizen.org/privilege/content.write
188 * @param[in] playlist_id The ID of media playlist
190 * @return @c 0 on success,
191 * otherwise a negative error value
193 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
194 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
195 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
196 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
197 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
198 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
199 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
201 * @pre This function requires opened connection to content service by media_content_connect().
203 * @see media_content_connect()
204 * @see media_playlist_insert_to_db()
206 int media_playlist_delete_from_db(int playlist_id) TIZEN_DEPRECATED_API;
209 * @deprecated Deprecated since 9.0.
210 * @brief Gets the media playlist from the media database.
212 * @details This function creates a new media playlist handle from the media database by the given @a playlist_id.
213 * The media playlist will be created and will be filled with the playlist information.
217 * @remarks The @a playlist should be released using media_playlist_destroy().
219 * @param[in] playlist_id The ID of the media playlist
220 * @param[out] playlist The handle to the media playlist
222 * @return @c 0 on success,
223 * otherwise a negative error value
225 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
226 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
227 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
228 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
229 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
231 * @pre This function requires opened connection to content service by media_content_connect().
233 * @see media_content_connect()
234 * @see media_playlist_destroy()
236 int media_playlist_get_playlist_from_db(int playlist_id, media_playlist_h *playlist) TIZEN_DEPRECATED_API;
239 * @deprecated Deprecated since 9.0.
240 * @brief Destroys a playlist handle.
241 * @details This function frees all resources related to the playlist handle. This
242 * handle no longer can be used to perform any operations. A new handle has to
243 * be created before next usage.
247 * @param[in] playlist The handle to the media playlist
249 * @return @c 0 on success,
250 * otherwise a negative error value
252 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
253 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
255 * @pre Get a copy of playlist handle by calling media_playlist_clone() or media_playlist_insert_to_db().
257 * @see media_playlist_clone()
259 int media_playlist_destroy(media_playlist_h playlist) TIZEN_DEPRECATED_API;
262 * @deprecated Deprecated since 9.0.
263 * @brief Clones a playlist handle.
264 * @details This function copies the media playlist handle from a source to
265 * destination. There is no media_playlist_create() function. The media_playlist_h is created internally and available through
266 * media playlist foreach function such as media_playlist_foreach_playlist_from_db().
267 * To use this handle outside of these foreach functions, use this function.
271 * @remarks The @a dst should be released using media_playlist_destroy().
273 * @param[out] dst The destination handle to the media playlist
274 * @param[in] src The source handle to the media playlist
276 * @return @c 0 on success,
277 * otherwise a negative error value
279 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
280 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
281 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
283 * @see media_playlist_destroy()
284 * @see media_playlist_foreach_playlist_from_db()
286 int media_playlist_clone(media_playlist_h *dst, media_playlist_h src) TIZEN_DEPRECATED_API;
289 * @deprecated Deprecated since 9.0.
290 * @brief Gets the media playlist ID.
293 * @param[in] playlist The handle to the media playlist
294 * @param[out] playlist_id The ID of the media playlist
296 * @return @c 0 on success,
297 * otherwise a negative error value
299 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
300 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
302 int media_playlist_get_playlist_id(media_playlist_h playlist, int *playlist_id) TIZEN_DEPRECATED_API;
305 * @deprecated Deprecated since 9.0.
306 * @brief Gets a name of the playlist.
309 * @remarks The @a playlist_name should be released using free().
311 * @param[in] playlist The handle to the media playlist
312 * @param[out] playlist_name The playlist name
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_OUT_OF_MEMORY Out of memory
321 int media_playlist_get_name(media_playlist_h playlist, char **playlist_name) TIZEN_DEPRECATED_API;
324 * @deprecated Deprecated since 9.0.
325 * @brief Sets the name of the playlist.
328 * @param[in] playlist The handle to the media playlist
329 * @param[in] playlist_name The name of the media playlist
331 * @return @c 0 on success,
332 * otherwise a negative error value
334 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
335 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
336 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
338 * @post media_playlist_update_to_db()
341 int media_playlist_set_name(media_playlist_h playlist, const char *playlist_name) TIZEN_DEPRECATED_API;
344 * @deprecated Deprecated since 9.0.
345 * @brief Gets a thumbnail path of the playlist.
348 * @remarks The @a path should be released using free().
350 * @param[in] playlist The handle to the media playlist
351 * @param[out] path The path of the thumbnail
353 * @return @c 0 on success,
354 * otherwise a negative error value
356 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
357 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
358 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
360 int media_playlist_get_thumbnail_path(media_playlist_h playlist, char **path) TIZEN_DEPRECATED_API;
363 * @deprecated Deprecated since 9.0.
364 * @brief Sets the thumbnail path of the playlist.
367 * @param[in] playlist The handle to the media playlist
368 * @param[in] path The path of the thumbnail
370 * @return @c 0 on success,
371 * otherwise a negative error value
373 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
374 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
375 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
377 * @post media_playlist_update_to_db()
379 int media_playlist_set_thumbnail_path(media_playlist_h playlist, const char *path) TIZEN_DEPRECATED_API;
383 * @deprecated Deprecated since 9.0.
384 * @brief Sets the playing order in the playlist.
387 * @param[in] playlist The handle to the media playlist
388 * @param[in] playlist_member_id The ID of the playlist member
389 * @param[in] play_order The playing order
391 * @return @c 0 on success,
392 * otherwise a negative error value
394 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
395 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
396 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
398 * @post media_playlist_update_to_db()
400 int media_playlist_set_play_order(media_playlist_h playlist, int playlist_member_id, int play_order) TIZEN_DEPRECATED_API;
403 * @deprecated Deprecated since 9.0.
404 * @brief Adds a new media info to the playlist.
407 * @param[in] playlist The handle to the media playlist
408 * @param[in] media_id The media ID
410 * @return @c 0 on success,
411 * otherwise a negative error value
413 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
414 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
415 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
417 * @pre This function requires opened connection to content service by media_content_connect().
418 * @post media_playlist_update_to_db()
420 * @see media_content_connect()
421 * @see media_playlist_remove_media()
423 int media_playlist_add_media(media_playlist_h playlist, const char *media_id) TIZEN_DEPRECATED_API;
426 * @deprecated Deprecated since 9.0.
427 * @brief Removes the playlist members related with the media from the given playlist.
430 * @param[in] playlist The handle to the media playlist
431 * @param[in] playlist_member_id The ID of the playlist member
433 * @return @c 0 on success,
434 * otherwise a negative error value
436 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
437 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
438 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
440 * @pre This function requires opened connection to content service by media_content_connect().
441 * @post media_playlist_update_to_db()
443 * @see media_content_connect()
444 * @see media_playlist_add_media()
446 int media_playlist_remove_media(media_playlist_h playlist, int playlist_member_id) TIZEN_DEPRECATED_API;
449 * @deprecated Deprecated since 9.0.
450 * @brief Gets the played order of the playlist.
453 * @param[in] playlist The handle to the media playlist
454 * @param[in] playlist_member_id The ID of the playlist member
455 * @param[out] play_order The played order
457 * @return @c 0 on success,
458 * otherwise a negative error value
460 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
461 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
463 int media_playlist_get_play_order(media_playlist_h playlist, int playlist_member_id, int *play_order) TIZEN_DEPRECATED_API;
466 * @deprecated Deprecated since 9.0.
467 * @brief Updates the media playlist to the media database.
469 * @details The function updates the given media playlist in the media database.
470 * The function should be called after any change in the playlist, to be updated to the media database.
471 * For example, after using media_playlist_set_name() for setting the name of the playlist, the
472 * media_playlist_update_to_db() function should be called so as to update
473 * the given playlist attributes in the media database.
478 * @privilege %http://tizen.org/privilege/content.write
480 * @param[in] playlist The handle to the media playlist
482 * @return @c 0 on success,
483 * otherwise a negative error value
485 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
486 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
487 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
488 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
489 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
490 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
491 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
492 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
494 * @pre This function requires opened connection to content service by media_content_connect().
496 * @see media_content_connect()
497 * @see media_playlist_destroy()
498 * @see media_playlist_add_media()
499 * @see media_playlist_remove_media()
500 * @see media_playlist_set_name()
501 * @see media_playlist_set_play_order()
503 int media_playlist_update_to_db(media_playlist_h playlist) TIZEN_DEPRECATED_API;
506 * @deprecated Deprecated since 9.0.
507 * @brief Imports the playlist from m3u playlist file.
508 * @details This function reads a playlist from the m3u playlist file and insert into the db.
512 * @privilege %http://tizen.org/privilege/content.write
514 * @remarks The @a playlist should be released using media_playlist_destroy().
515 * @remarks %http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
516 * %http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. \n
517 * This function does not support the file of extended m3u playlist.
519 * @param[in] playlist_name The name of the media playlist to save
520 * @param[in] path The path to import the playlist file
521 * @param[out] playlist The handle to the media playlist
523 * @return @c 0 on success,
524 * otherwise a negative error value
526 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
527 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
528 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
529 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
530 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
531 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
532 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
533 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
535 int media_playlist_import_from_file(const char *playlist_name, const char *path, media_playlist_h *playlist) TIZEN_DEPRECATED_API;
538 * @deprecated Deprecated since 9.0.
539 * @brief Exports the playlist to m3u playlist file.
542 * @remarks %http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. \n
543 * %http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage.
545 * @param[in] playlist The handle to the media playlist
546 * @param[in] path path The path to export the playlist
548 * @return @c 0 on success,
549 * otherwise a negative error value
551 * @retval #MEDIA_CONTENT_ERROR_NONE Successful
552 * @retval #MEDIA_CONTENT_ERROR_INVALID_PARAMETER Invalid parameter
553 * @retval #MEDIA_CONTENT_ERROR_OUT_OF_MEMORY Out of memory
554 * @retval #MEDIA_CONTENT_ERROR_INVALID_OPERATION Invalid operation
555 * @retval #MEDIA_CONTENT_ERROR_DB_FAILED DB Operation failed
556 * @retval #MEDIA_CONTENT_ERROR_DB_BUSY DB Operation busy
557 * @retval #MEDIA_CONTENT_ERROR_NETWORK Network fail
558 * @retval #MEDIA_CONTENT_ERROR_PERMISSION_DENIED Permission denied
560 int media_playlist_export_to_file(media_playlist_h playlist, const char* path) TIZEN_DEPRECATED_API;
568 #endif /* __cplusplus */
569 #endif /*__TIZEN_CONTENT_MEDIA_PLAYLIST_H__*/