Qt: add AV1 in profiles codecs
[vlc.git] / include / vlc_playlist.h
blobe0e56c4bb016ff3f20940e8d663d5e543504b8d1
1 /*****************************************************************************
2 * vlc_playlist.h
3 *****************************************************************************
4 * Copyright (C) 2018 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
21 #ifndef VLC_PLAYLIST_NEW_H
22 #define VLC_PLAYLIST_NEW_H
24 #include <vlc_common.h>
26 # ifdef __cplusplus
27 extern "C" {
28 # endif
30 /**
31 * \defgroup playlist playlist
32 * \ingroup playlist
33 * @{
36 /**
37 * A VLC playlist contains a list of "playlist items".
39 * Each playlist item contains exactly one media (input item). In the future,
40 * it might contain associated data.
42 * The API is intended to be simple, UI-friendly and allow for an
43 * implementation both correct (no race conditions) and performant for common
44 * use cases.
46 * UI frameworks typically use "list models" to provide a list of items to a
47 * list view component. A list model requires to implement functions to:
48 * - return the total number of items,
49 * - return the item at a given index.
51 * In addition, it must notify the view when changes occur when:
52 * - items are inserted (providing index and count),
53 * - items are removed (providing index and count),
54 * - items are moved (providing index, count, and target index),
55 * - items are updated (providing index and count),
56 * - the model is reset (the whole content should be considered changed).
58 * The API directly exposes what list models require.
60 * The core playlist may be modified from any thread, so it may not be used as
61 * a direct data source for a list model. In other word, the functions of a
62 * list model must not delegate the calls to the playlist. This would require
63 * locking the playlist individually for each call to get the count and
64 * retrieve each item (which is, in itself, not a good idea for UI
65 * responsiveness), and would not be sufficient to guarantee correctness: the
66 * playlist content could change between view calls so that a request to
67 * retrieve an item at a specific index could be invalid (which would break the
68 * list model expected behavior).
70 * As a consequence, the UI playlist should be considered as a remote
71 * out-of-sync view of the core playlist. This implies that the UI needs to
72 * keep a copy of the playlist content.
74 * Note that the copy must not limited to the list of playlist items (pointers)
75 * themselves, but also to the items content which is displayed and susceptible
76 * to change asynchronously (e.g. media metadata, like title or duration). The
77 * UI should never lock a media (input item) for rendering a playlist item;
78 * otherwise, the content could be changed (and exposed) before the list model
79 * notified the view of this change (which, again, would break the list model
80 * expected behavior).
82 * It is very important that the copy hold by the UI is only modified through
83 * the core playlist callbacks, to guarantee that the indexes notified are
84 * valid in the context of the list model. In other words, from the client, the
85 * playlist copy is a read-only "desynchronized" view of the core playlist.
87 * Moreover, the events triggered by the playlist must be kept in order until
88 * they are handled. The callbacks may be called from any thread, with lock
89 * held (in practice, the thread from which a change is requested). An UI will
90 * typically need to handle the events in the UI thread, so it will usually
91 * post the events in an even loop, to handle them from the UI thread. In that
92 * case, be careful to always post the events in the event loop, even if the
93 * current thread is already the UI thread, not to break the order of events.
95 * The playlist also handles the playback order and the repeat mode. It also
96 * manages a cursor to the "current" item, and expose whether a previous and
97 * next items (which depend on the playback order and repeat mode) are
98 * available.
100 * When a user requests to insert, move or remove items, or to set the current
101 * item, before the core playlist lock is successfully acquired, another client
102 * may have changed the list. Therefore, vlc_playlist_Request*() functions are
103 * exposed to resolve potential conflicts and apply the changes. The actual
104 * changes applied are notified through the callbacks
107 /* forward declarations */
108 typedef struct input_item_t input_item_t;
109 typedef struct vlc_player_t vlc_player_t;
111 /* opaque types */
112 typedef struct vlc_playlist vlc_playlist_t;
113 typedef struct vlc_playlist_item vlc_playlist_item_t;
114 typedef struct vlc_playlist_listener_id vlc_playlist_listener_id;
116 enum vlc_playlist_playback_repeat
118 VLC_PLAYLIST_PLAYBACK_REPEAT_NONE,
119 VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT,
120 VLC_PLAYLIST_PLAYBACK_REPEAT_ALL,
123 enum vlc_playlist_playback_order
125 VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL,
126 VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM,
129 enum vlc_playlist_sort_key
131 VLC_PLAYLIST_SORT_KEY_TITLE,
132 VLC_PLAYLIST_SORT_KEY_DURATION,
133 VLC_PLAYLIST_SORT_KEY_ARTIST,
134 VLC_PLAYLIST_SORT_KEY_ALBUM,
135 VLC_PLAYLIST_SORT_KEY_ALBUM_ARTIST,
136 VLC_PLAYLIST_SORT_KEY_GENRE,
137 VLC_PLAYLIST_SORT_KEY_DATE,
138 VLC_PLAYLIST_SORT_KEY_TRACK_NUMBER,
139 VLC_PLAYLIST_SORT_KEY_DISC_NUMBER,
140 VLC_PLAYLIST_SORT_KEY_URL,
141 VLC_PLAYLIST_SORT_KEY_RATING,
144 enum vlc_playlist_sort_order
146 VLC_PLAYLIST_SORT_ORDER_ASCENDING,
147 VLC_PLAYLIST_SORT_ORDER_DESCENDING,
150 struct vlc_playlist_sort_criterion
152 enum vlc_playlist_sort_key key;
153 enum vlc_playlist_sort_order order;
157 * Playlist callbacks.
159 * A client may register a listener using vlc_playlist_AddListener() to listen
160 * playlist events.
162 * All callbacks are called with the playlist locked (see vlc_playlist_Lock()).
164 struct vlc_playlist_callbacks
167 * Called when the whole content has changed (e.g. when the playlist has
168 * been cleared, shuffled or sorted).
170 * \param playlist the playlist
171 * \param items the whole new content of the playlist
172 * \param count the number of items
173 * \param userdata userdata provided to AddListener()
175 void
176 (*on_items_reset)(vlc_playlist_t *, vlc_playlist_item_t *const items[],
177 size_t count, void *userdata);
180 * Called when items have been added to the playlist.
182 * \param playlist the playlist
183 * \param index the index of the insertion
184 * \param items the array of added items
185 * \param count the number of items added
186 * \param userdata userdata provided to AddListener()
188 void
189 (*on_items_added)(vlc_playlist_t *playlist, size_t index,
190 vlc_playlist_item_t *const items[], size_t count,
191 void *userdata);
194 * Called when a slice of items have been moved.
196 * \param playlist the playlist
197 * \param index the index of the first moved item
198 * \param count the number of items moved
199 * \param target the new index of the moved slice
200 * \param userdata userdata provided to AddListener()
202 void
203 (*on_items_moved)(vlc_playlist_t *playlist, size_t index, size_t count,
204 size_t target, void *userdata);
206 * Called when a slice of items have been removed from the playlist.
208 * \param playlist the playlist
209 * \param index the index of the first removed item
210 * \param items the array of removed items
211 * \param count the number of items removed
212 * \param userdata userdata provided to AddListener()
214 void
215 (*on_items_removed)(vlc_playlist_t *playlist, size_t index, size_t count,
216 void *userdata);
219 * Called when an item has been updated via (pre-)parsing.
221 * \param playlist the playlist
222 * \param index the index of the first updated item
223 * \param items the array of updated items
224 * \param count the number of items updated
225 * \param userdata userdata provided to AddListener()
227 void
228 (*on_items_updated)(vlc_playlist_t *playlist, size_t index,
229 vlc_playlist_item_t *const items[], size_t count,
230 void *userdata);
233 * Called when the playback repeat mode has been changed.
235 * \param playlist the playlist
236 * \param repeat the new playback "repeat" mode
237 * \param userdata userdata provided to AddListener()
239 void
240 (*on_playback_repeat_changed)(vlc_playlist_t *playlist,
241 enum vlc_playlist_playback_repeat repeat,
242 void *userdata);
245 * Called when the playback order mode has been changed.
247 * \param playlist the playlist
248 * \param rorder the new playback order
249 * \param userdata userdata provided to AddListener()
251 void
252 (*on_playback_order_changed)(vlc_playlist_t *playlist,
253 enum vlc_playlist_playback_order order,
254 void *userdata);
257 * Called when the current item index has changed.
259 * Note that the current item index may have changed while the current item
260 * is still the same: it may have been moved.
262 * \param playlist the playlist
263 * \param index the new current index (-1 if there is no current item)
264 * \param userdata userdata provided to AddListener()
266 void
267 (*on_current_index_changed)(vlc_playlist_t *playlist, ssize_t index,
268 void *userdata);
271 * Called when the "has previous item" property has changed.
273 * This is typically useful to update any "previous" button in the UI.
275 * \param playlist the playlist
276 * \param has_prev true if there is a previous item, false otherwise
277 * \param userdata userdata provided to AddListener()
279 void
280 (*on_has_prev_changed)(vlc_playlist_t *playlist, bool has_prev,
281 void *userdata);
284 * Called when the "has next item" property has changed.
286 * This is typically useful to update any "next" button in the UI.
288 * \param playlist the playlist
289 * \param has_next true if there is a next item, false otherwise
290 * \param userdata userdata provided to AddListener()
292 void
293 (*on_has_next_changed)(vlc_playlist_t *playlist,
294 bool has_next, void *userdata);
297 /* Playlist items */
300 * Hold a playlist item.
302 * Increment the refcount of the playlist item.
304 VLC_API void
305 vlc_playlist_item_Hold(vlc_playlist_item_t *);
308 * Release a playlist item.
310 * Decrement the refcount of the playlist item, and destroy it if necessary.
312 VLC_API void
313 vlc_playlist_item_Release(vlc_playlist_item_t *);
316 * Return the media associated to the playlist item.
318 VLC_API input_item_t *
319 vlc_playlist_item_GetMedia(vlc_playlist_item_t *);
321 /* Playlist */
324 * Create a new playlist.
326 * \param parent a VLC object
327 * \return a pointer to a valid playlist instance, or NULL if an error occurred
329 VLC_API VLC_USED vlc_playlist_t *
330 vlc_playlist_New(vlc_object_t *parent);
333 * Delete a playlist.
335 * All playlist items are released, and listeners are removed and destroyed.
337 VLC_API void
338 vlc_playlist_Delete(vlc_playlist_t *);
341 * Lock the playlist/player.
343 * The playlist and its player share the same lock, to avoid lock-order
344 * inversion issues.
346 * \warning Do not forget that the playlist and player lock are the same (or
347 * you could lock twice the same and deadlock).
349 * Almost all playlist functions must be called with lock held (check their
350 * description).
352 * The lock is not recursive.
354 VLC_API void
355 vlc_playlist_Lock(vlc_playlist_t *);
358 * Unlock the playlist/player.
360 VLC_API void
361 vlc_playlist_Unlock(vlc_playlist_t *);
364 * Add a playlist listener.
366 * Return an opaque listener identifier, to be passed to
367 * vlc_player_RemoveListener().
369 * If notify_current_state is true, the callbacks are called once with the
370 * current state of the playlist. This is useful because when a client
371 * registers to the playlist, it may already contain items. Calling callbacks
372 * is a convenient way to initialize the client automatically.
374 * \param playlist the playlist, locked
375 * \param cbs the callbacks (must be valid until the listener
376 * is removed)
377 * \param userdata userdata provided as a parameter in callbacks
378 * \param notify_current_state true to notify the current state immediately via
379 * callbacks
380 * \return a listener identifier, or NULL if an error occurred
382 VLC_API VLC_USED vlc_playlist_listener_id *
383 vlc_playlist_AddListener(vlc_playlist_t *playlist,
384 const struct vlc_playlist_callbacks *cbs,
385 void *userdata, bool notify_current_state);
388 * Remove a player listener.
390 * \param playlist the playlist, locked
391 * \param id the listener identifier returned by
392 * vlc_playlist_AddListener()
394 VLC_API void
395 vlc_playlist_RemoveListener(vlc_playlist_t *, vlc_playlist_listener_id *);
398 * Return the number of items.
400 * \param playlist the playlist, locked
402 VLC_API size_t
403 vlc_playlist_Count(vlc_playlist_t *playlist);
406 * Return the item at a given index.
408 * The index must be in range (less than vlc_playlist_Count()).
410 * \param playlist the playlist, locked
411 * \param index the index
412 * \return the playlist item
414 VLC_API vlc_playlist_item_t *
415 vlc_playlist_Get(vlc_playlist_t *playlist, size_t index);
418 * Clear the playlist.
420 * \param playlist the playlist, locked
422 VLC_API void
423 vlc_playlist_Clear(vlc_playlist_t *playlist);
426 * Insert a list of media at a given index.
428 * The index must be in range (less than or equal to vlc_playlist_Count()).
430 * \param playlist the playlist, locked
431 * \index index the index where the media are to be inserted
432 * \param media the array of media to insert
433 * \param count the number of media to insert
434 * \return VLC_SUCCESS on success, another value on error
436 VLC_API int
437 vlc_playlist_Insert(vlc_playlist_t *playlist, size_t index,
438 input_item_t *const media[], size_t count);
441 * Insert a media at a given index.
443 * The index must be in range (less than or equal to vlc_playlist_Count()).
445 * \param playlist the playlist, locked
446 * \index index the index where the media is to be inserted
447 * \param media the media to insert
448 * \return VLC_SUCCESS on success, another value on error
450 static inline int
451 vlc_playlist_InsertOne(vlc_playlist_t *playlist, size_t index,
452 input_item_t *media)
454 return vlc_playlist_Insert(playlist, index, &media, 1);
458 * Add a list of media at the end of the playlist.
460 * \param playlist the playlist, locked
461 * \param media the array of media to append
462 * \param count the number of media to append
463 * \return VLC_SUCCESS on success, another value on error
465 static inline int
466 vlc_playlist_Append(vlc_playlist_t *playlist, input_item_t *const media[],
467 size_t count)
469 size_t size = vlc_playlist_Count(playlist);
470 return vlc_playlist_Insert(playlist, size, media, count);
474 * Add a media at the end of the playlist.
476 * \param playlist the playlist, locked
477 * \param media the media to append
478 * \return VLC_SUCCESS on success, another value on error
480 static inline int
481 vlc_playlist_AppendOne(vlc_playlist_t *playlist, input_item_t *media)
483 return vlc_playlist_Append(playlist, &media, 1);
487 * Move a slice of items to a given target index.
489 * The slice and the target must be in range (both index+count and target+count
490 * less than or equal to vlc_playlist_Count()).
492 * \param playlist the playlist, locked
493 * \param index the index of the first item to move
494 * \param count the number of items to move
495 * \param target the new index of the moved slice
497 VLC_API void
498 vlc_playlist_Move(vlc_playlist_t *playlist, size_t index, size_t count,
499 size_t target);
502 * Move an item to a given target index.
504 * The index and the target must be in range (index less than, and target less
505 * than or equal to, vlc_playlist_Count()).
507 * \param playlist the playlist, locked
508 * \param index the index of the item to move
509 * \param target the new index of the moved item
511 static inline void
512 vlc_playlist_MoveOne(vlc_playlist_t *playlist, size_t index, size_t target)
514 vlc_playlist_Move(playlist, index, 1, target);
518 * Remove a slice of items at a given index.
520 * The slice must be in range (index+count less than or equal to
521 * vlc_playlist_Count()).
523 * \param playlist the playlist, locked
524 * \param index the index of the first item to remove
525 * \param count the number of items to remove
527 VLC_API void
528 vlc_playlist_Remove(vlc_playlist_t *playlist, size_t index, size_t count);
531 * Remove an item at a given index.
533 * The index must be in range (less than vlc_playlist_Count()).
535 * \param playlist the playlist, locked
536 * \param index the index of the item to remove
538 static inline void
539 vlc_playlist_RemoveOne(vlc_playlist_t *playlist, size_t index)
541 vlc_playlist_Remove(playlist, index, 1);
545 * Insert a list of media at a given index (if in range), or append.
547 * Contrary to vlc_playlist_Insert(), the index need not be in range: if it is
548 * out of bounds, items will be appended.
550 * This is an helper to apply a desynchronized insert request, i.e. the
551 * playlist content may have changed since the request had been submitted.
552 * This is typically the case for user requests (e.g. from UI), because the
553 * playlist lock has to be acquired *after* the user requested the
554 * change.
556 * \param playlist the playlist, locked
557 * \index index the index where the media are to be inserted
558 * \param media the array of media to insert
559 * \param count the number of media to insert
560 * \return VLC_SUCCESS on success, another value on error
562 VLC_API int
563 vlc_playlist_RequestInsert(vlc_playlist_t *playlist, size_t index,
564 input_item_t *const media[], size_t count);
567 * Move a slice of items by value.
569 * If the indices are known, use vlc_playlist_Move() instead.
571 * This is an helper to apply a desynchronized move request, i.e. the playlist
572 * content may have changed since the request had been submitted. This is
573 * typically the case for user requests (e.g. from UI), because the playlist
574 * lock has to be acquired *after* the user requested the change.
576 * For optimization purpose, it is possible to pass an `index_hint`, which is
577 * the expected index of the first item of the slice (as known by the client).
578 * Hopefully, the index should often match, since conflicts are expected to be
579 * rare. Pass -1 not to pass any hint.
581 * \param playlist the playlist, locked
582 * \param items the array of items to move
583 * \param count the number of items to move
584 * \param target the new index of the moved slice
585 * \param index_hint the expected index of the first item (-1 for none)
586 * \return VLC_SUCCESS on success, another value on error
588 VLC_API int
589 vlc_playlist_RequestMove(vlc_playlist_t *playlist,
590 vlc_playlist_item_t *const items[], size_t count,
591 size_t target, ssize_t index_hint);
594 * Remove a slice of items by value.
596 * If the indices are known, use vlc_playlist_Remove() instead.
598 * This is an helper to apply a desynchronized remove request, i.e. the
599 * playlist content may have changed since the request had been submitted.
600 * This is typically the case for user requests (e.g. from UI), because the
601 * playlist lock has to be acquired *after* the user requested the change.
603 * For optimization purpose, it is possible to pass an `index_hint`, which is
604 * the expected index of the first item of the slice (as known by the client).
605 * Hopefully, the index should often match, since conflicts are expected to be
606 * rare. Pass -1 not to pass any hint.
608 * \param playlist the playlist, locked
609 * \param items the array of items to remove
610 * \param count the number of items to remove
611 * \param index_hint the expected index of the first item (-1 for none)
612 * \return VLC_SUCCESS on success, another value on error
614 VLC_API int
615 vlc_playlist_RequestRemove(vlc_playlist_t *playlist,
616 vlc_playlist_item_t *const items[], size_t count,
617 ssize_t index_hint);
620 * Shuffle the playlist.
622 * \param playlist the playlist, locked
624 VLC_API void
625 vlc_playlist_Shuffle(vlc_playlist_t *playlist);
628 * Sort the playlist by a list of criteria.
630 * \param playlist the playlist, locked
631 * \param criteria the sort criteria (in order)
632 * \param count the number of criteria
633 * \return VLC_SUCCESS on success, another value on error
635 VLC_API int
636 vlc_playlist_Sort(vlc_playlist_t *playlist,
637 const struct vlc_playlist_sort_criterion criteria[],
638 size_t count);
641 * Return the index of a given item.
643 * \param playlist the playlist, locked
644 * \param item the item to locate
645 * \return the index of the item (-1 if not found)
647 VLC_API ssize_t
648 vlc_playlist_IndexOf(vlc_playlist_t *playlist, const vlc_playlist_item_t *item);
651 * Return the index of a given media.
653 * \param playlist the playlist, locked
654 * \param media the media to locate
655 * \return the index of the playlist item containing the media (-1 if not found)
657 VLC_API ssize_t
658 vlc_playlist_IndexOfMedia(vlc_playlist_t *playlist, const input_item_t *media);
661 * Return the playback "repeat" mode.
663 * \param playlist the playlist, locked
664 * \return the playback "repeat" mode
666 VLC_API enum vlc_playlist_playback_repeat
667 vlc_playlist_GetPlaybackRepeat(vlc_playlist_t *playlist);
670 * Return the playback order.
672 * \param playlist the playlist, locked
673 * \return the playback order
675 VLC_API enum vlc_playlist_playback_order
676 vlc_playlist_GetPlaybackOrder(vlc_playlist_t *);
679 * Change the playback "repeat" mode.
681 * \param playlist the playlist, locked
682 * \param repeat the new playback "repeat" mode
684 VLC_API void
685 vlc_playlist_SetPlaybackRepeat(vlc_playlist_t *playlist,
686 enum vlc_playlist_playback_repeat repeat);
689 * Change the playback order
691 * \param playlist the playlist, locked
692 * \param repeat the new playback order
694 VLC_API void
695 vlc_playlist_SetPlaybackOrder(vlc_playlist_t *playlist,
696 enum vlc_playlist_playback_order order);
699 * Return the index of the current item.
701 * \param playlist the playlist, locked
702 * \return the index of the current item, -1 if none.
704 VLC_API ssize_t
705 vlc_playlist_GetCurrentIndex(vlc_playlist_t *playlist);
708 * Indicate whether a previous item is available.
710 * \param playlist the playlist, locked
711 * \retval true if a previous item is available
712 * \retval false if no previous item is available
714 VLC_API bool
715 vlc_playlist_HasPrev(vlc_playlist_t *playlist);
718 * Indicate whether a next item is available.
720 * \param playlist the playlist, locked
721 * \retval true if a next item is available
722 * \retval false if no next item is available
724 VLC_API bool
725 vlc_playlist_HasNext(vlc_playlist_t *playlist);
728 * Go to the previous item.
730 * Return VLC_EGENERIC if vlc_playlist_HasPrev() returns false.
732 * \param playlist the playlist, locked
733 * \return VLC_SUCCESS on success, another value on error
735 VLC_API int
736 vlc_playlist_Prev(vlc_playlist_t *playlist);
739 * Go to the next item.
741 * Return VLC_EGENERIC if vlc_playlist_HasNext() returns false.
743 * \param playlist the playlist, locked
744 * \return VLC_SUCCESS on success, another value on error
746 VLC_API int
747 vlc_playlist_Next(vlc_playlist_t *playlist);
750 * Go to a given index.
752 * the index must be -1 or in range (less than vlc_playlist_Count()).
754 * \param playlist the playlist, locked
755 * \param index the index to go to (-1 to none)
756 * \return VLC_SUCCESS on success, another value on error
758 VLC_API int
759 vlc_playlist_GoTo(vlc_playlist_t *playlist, ssize_t index);
762 * Go to a given item.
764 * If the index is known, use vlc_playlist_GoTo() instead.
766 * This is an helper to apply a desynchronized "go to" request, i.e. the
767 * playlist content may have changed since the request had been submitted.
768 * This is typically the case for user requests (e.g. from UI), because the
769 * playlist lock has to be acquired *after* the user requested the change.
771 * For optimization purpose, it is possible to pass an `index_hint`, which is
772 * the expected index of the first item of the slice (as known by the client).
773 * Hopefully, the index should often match, since conflicts are expected to be
774 * rare. Pass -1 not to pass any hint.
776 * \param playlist the playlist, locked
777 * \param item the item to go to (NULL for none)
778 * \param index_hint the expected index of the item (-1 for none)
779 * \return VLC_SUCCESS on success, another value on error
781 VLC_API int
782 vlc_playlist_RequestGoTo(vlc_playlist_t *playlist, vlc_playlist_item_t *item,
783 ssize_t index_hint);
786 * Return the player owned by the playlist.
788 * \param playlist the playlist (not necessarily locked)
789 * \return the player
791 VLC_API vlc_player_t *
792 vlc_playlist_GetPlayer(vlc_playlist_t *playlist);
795 * Start the player.
797 * \param playlist the playlist, locked
798 * \return VLC_SUCCESS on success, another value on error
800 VLC_API int
801 vlc_playlist_Start(vlc_playlist_t *playlist);
804 * Stop the player.
806 * \param playlist the playlist, locked
807 * \return VLC_SUCCESS on success, another value on error
809 VLC_API void
810 vlc_playlist_Stop(vlc_playlist_t *playlist);
813 * Pause the player.
815 * \param playlist the playlist, locked
816 * \return VLC_SUCCESS on success, another value on error
818 VLC_API void
819 vlc_playlist_Pause(vlc_playlist_t *playlist);
822 * Resume the player.
824 * \param playlist the playlist, locked
825 * \return VLC_SUCCESS on success, another value on error
827 VLC_API void
828 vlc_playlist_Resume(vlc_playlist_t *playlist);
831 * Go to the given index and plays the corresponding item.
833 * \param playlist the playlist, locked
834 * \param index the index to play at
835 * \return VLC_SUCCESS on success, another value on error
837 static inline int
838 vlc_playlist_PlayAt(vlc_playlist_t *playlist, size_t index)
840 int ret = vlc_playlist_GoTo(playlist, index);
841 if (ret != VLC_SUCCESS)
842 return ret;
843 return vlc_playlist_Start(playlist);
847 * Preparse a media, and expand it in the playlist on subitems added.
849 * \param playlist the playlist (not necessarily locked)
850 * \param libvlc the libvlc instance
851 * \param media the media to preparse
853 VLC_API void
854 vlc_playlist_Preparse(vlc_playlist_t *playlist, libvlc_int_t *libvlc,
855 input_item_t *media);
857 /** @} */
858 # ifdef __cplusplus
860 # endif
862 #endif