VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_playlist.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_playlist.h
3 *****************************************************************************
4 * Copyright (C) 2018 VLC authors and VideoLAN
5 *
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.
10 *
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.
15 *
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 *****************************************************************************/
20
21#ifndef VLC_PLAYLIST_NEW_H
22#define VLC_PLAYLIST_NEW_H
23
24#include <vlc_common.h>
25
26# ifdef __cplusplus
27extern "C" {
28# endif
29
30/**
31 * \defgroup playlist VLC playlist
32 * \ingroup interface
33 *
34 * A VLC playlist contains a list of "playlist items".
35 *
36 * Each playlist item contains exactly one media (input item). In the future,
37 * it might contain associated data.
38 *
39 * The API is intended to be simple, UI-friendly and allow for an
40 * implementation both correct (no race conditions) and performant for common
41 * use cases.
42 *
43 * UI frameworks typically use "list models" to provide a list of items to a
44 * list view component. A list model requires to implement functions to:
45 * - return the total number of items,
46 * - return the item at a given index.
47 *
48 * In addition, it must notify the view when changes occur when:
49 * - items are inserted (providing index and count),
50 * - items are removed (providing index and count),
51 * - items are moved (providing index, count, and target index),
52 * - items are updated (providing index and count),
53 * - the model is reset (the whole content should be considered changed).
54 *
55 * The API directly exposes what list models require.
56 *
57 * The core playlist may be modified from any thread, so it may not be used as
58 * a direct data source for a list model. In other words, the functions of a
59 * list model must not delegate the calls to the playlist. This would require
60 * locking the playlist individually for each call to get the count and
61 * retrieve each item (which is, in itself, not a good idea for UI
62 * responsiveness), and would not be sufficient to guarantee correctness: the
63 * playlist content could change between view calls so that a request to
64 * retrieve an item at a specific index could be invalid (which would break the
65 * list model expected behavior).
66 *
67 * As a consequence, the UI playlist should be considered as a remote
68 * out-of-sync view of the core playlist. This implies that the UI needs to
69 * keep a copy of the playlist content.
70 *
71 * Note that the copy must not be limited to the list of playlist items
72 * (pointers) themselves, but also to the item's content which is displayed and
73 * susceptible to change asynchronously (e.g. media metadata, like title or
74 * duration). The UI should never lock a media (input item) for rendering a
75 * playlist item; otherwise, the content could be changed (and exposed) before
76 * the list model notified the view of this change (which, again, would break
77 * the list model expected behavior).
78 *
79 * It is very important that the copy held by the UI is only modified through
80 * the core playlist callbacks, to guarantee that the indexes notified are
81 * valid in the context of the list model. In other words, from the client, the
82 * playlist copy is a read-only "desynchronized" view of the core playlist.
83 *
84 * Moreover, the events triggered by the playlist must be kept in order until
85 * they are handled. The callbacks may be called from any thread, with lock
86 * held (in practice, the thread from which a change is requested). A UI will
87 * typically need to handle the events in the UI thread, so it will usually
88 * post the events in an event loop, to handle them from the UI thread. In that
89 * case, be careful to always post the events in the event loop, even if the
90 * current thread is already the UI thread, not to break the order of events.
91 *
92 * The playlist also handles the playback order and the repeat mode. It also
93 * manages a cursor to the "current" item, and exposes whether previous and
94 * next items (which depend on the playback order and repeat mode) are
95 * available.
96 *
97 * When a user requests to insert, move or remove items, or to set the current
98 * item, before the core playlist lock is successfully acquired, another client
99 * may have changed the list. Therefore, vlc_playlist_Request*() functions are
100 * exposed to resolve potential conflicts and apply the changes. The actual
101 * changes applied are notified through the callbacks.
102 *
103 * @{
104 */
105
106/* forward declarations */
107typedef struct input_item_t input_item_t;
110/* opaque types */
111typedef struct vlc_playlist vlc_playlist_t;
157/**
158 * Action when a media is stopped
159 *
160 * @see vlc_playlist_SetMediaStoppedAction()
161 */
163 /** Continue (or stop if there is no next media), default behavior */
165 /** Pause when reaching the end of file */
167 /** Stop, even if there is a next media to play */
169 /** Exit VLC */
172
173/**
174 * Playlist callbacks.
175 *
176 * A client may register a listener using vlc_playlist_AddListener() to listen
177 * playlist events.
178 *
179 * All callbacks are called with the playlist locked (see vlc_playlist_Lock()).
180 */
183 /**
184 * Called when the whole content has changed (e.g. when the playlist has
185 * been cleared, shuffled or sorted).
186 *
187 * \param playlist the playlist
188 * \param items the whole new content of the playlist
189 * \param count the number of items
190 * \param userdata userdata provided to AddListener()
191 */
192 void
194 size_t count, void *userdata);
195
196 /**
197 * Called when items have been added to the playlist.
198 *
199 * \param playlist the playlist
200 * \param index the index of the insertion
201 * \param items the array of added items
202 * \param count the number of items added
203 * \param userdata userdata provided to AddListener()
204 */
205 void
206 (*on_items_added)(vlc_playlist_t *playlist, size_t index,
207 vlc_playlist_item_t *const items[], size_t count,
208 void *userdata);
209
210 /**
211 * Called when a slice of items have been moved.
212 *
213 * \param playlist the playlist
214 * \param index the index of the first moved item
215 * \param count the number of items moved
216 * \param target the new index of the moved slice
217 * \param userdata userdata provided to AddListener()
218 */
219 void
220 (*on_items_moved)(vlc_playlist_t *playlist, size_t index, size_t count,
221 size_t target, void *userdata);
222 /**
223 * Called when a slice of items have been removed from the playlist.
224 *
225 * \param playlist the playlist
226 * \param index the index of the first removed item
227 * \param count the number of items removed
228 * \param userdata userdata provided to AddListener()
229 */
230 void
231 (*on_items_removed)(vlc_playlist_t *playlist, size_t index, size_t count,
232 void *userdata);
233
234 /**
235 * Called when an item has been updated via (pre-)parsing.
236 *
237 * \param playlist the playlist
238 * \param index the index of the first updated item
239 * \param items the array of updated items
240 * \param count the number of items updated
241 * \param userdata userdata provided to AddListener()
242 */
243 void
244 (*on_items_updated)(vlc_playlist_t *playlist, size_t index,
245 vlc_playlist_item_t *const items[], size_t count,
246 void *userdata);
247
248 /**
249 * Called when the playback repeat mode has been changed.
250 *
251 * \param playlist the playlist
252 * \param repeat the new playback "repeat" mode
253 * \param userdata userdata provided to AddListener()
254 */
255 void
258 void *userdata);
259
260 /**
261 * Called when the playback order mode has been changed.
262 *
263 * \param playlist the playlist
264 * \param rorder the new playback order
265 * \param userdata userdata provided to AddListener()
266 */
267 void
270 void *userdata);
271
272 /**
273 * Called when the current item index has changed.
274 *
275 * Note that the current item index may have changed while the current item
276 * is still the same: it may have been moved.
277 *
278 * \param playlist the playlist
279 * \param index the new current index (-1 if there is no current item)
280 * \param userdata userdata provided to AddListener()
281 */
282 void
283 (*on_current_index_changed)(vlc_playlist_t *playlist, ssize_t index,
284 void *userdata);
285
286 /**
287 * Called when the "has previous item" property has changed.
288 *
289 * This is typically useful to update any "previous" button in the UI.
290 *
291 * \param playlist the playlist
292 * \param has_prev true if there is a previous item, false otherwise
293 * \param userdata userdata provided to AddListener()
294 */
295 void
296 (*on_has_prev_changed)(vlc_playlist_t *playlist, bool has_prev,
297 void *userdata);
298
299 /**
300 * Called when the "has next item" property has changed.
301 *
302 * This is typically useful to update any "next" button in the UI.
303 *
304 * \param playlist the playlist
305 * \param has_next true if there is a next item, false otherwise
306 * \param userdata userdata provided to AddListener()
307 */
308 void
310 bool has_next, void *userdata);
311
312 /**
313 * Called when the stopped action has changed
314 *
315 * @see vlc_playlist_SetMediaStoppedAction()
316 *
317 * \param playlist the playlist
318 * @param new_action action to execute when a media is stopped
319 * \param userdata userdata provided to AddListener()
320 */
323 void *userdata);
324};
325
326/* Playlist items */
327
328/**
329 * Hold a playlist item.
330 *
331 * Increment the refcount of the playlist item.
332 */
333VLC_API void
335
336/**
337 * Release a playlist item.
338 *
339 * Decrement the refcount of the playlist item, and destroy it if necessary.
340 */
341VLC_API void
343
344/**
345 * Return the media associated to the playlist item.
346 */
349
350/**
351 * Return a unique id for the playlist item instance.
352 */
353VLC_API uint64_t
355
356/* Playlist */
357
358/**
359 * Create a new playlist.
360 *
361 * \param parent a VLC object
362 * \return a pointer to a valid playlist instance, or NULL if an error occurred
363 */
366
367/**
368 * Delete a playlist.
369 *
370 * All playlist items are released, and listeners are removed and destroyed.
371 */
372VLC_API void
374
375/**
376 * Lock the playlist/player.
377 *
378 * The playlist and its player share the same lock, to avoid lock-order
379 * inversion issues.
380 *
381 * \warning Do not forget that the playlist and player lock are the same (or
382 * you could lock twice the same and deadlock).
383 *
384 * Almost all playlist functions must be called with lock held (check their
385 * description).
386 *
387 * The lock is not recursive.
388 */
389VLC_API void
391
392/**
393 * Unlock the playlist/player.
394 */
395VLC_API void
397
398/**
399 * Add a playlist listener.
400 *
401 * Return an opaque listener identifier, to be passed to
402 * vlc_player_RemoveListener().
403 *
404 * If notify_current_state is true, the callbacks are called once with the
405 * current state of the playlist. This is useful because when a client
406 * registers to the playlist, it may already contain items. Calling callbacks
407 * is a convenient way to initialize the client automatically.
408 *
409 * \param playlist the playlist, locked
410 * \param cbs the callbacks (must be valid until the listener
411 * is removed)
412 * \param userdata userdata provided as a parameter in callbacks
413 * \param notify_current_state true to notify the current state immediately via
414 * callbacks
415 * \return a listener identifier, or NULL if an error occurred
416 */
419 const struct vlc_playlist_callbacks *cbs,
420 void *userdata, bool notify_current_state);
421
422/**
423 * Remove a player listener.
424 *
425 * \param playlist the playlist, locked
426 * \param id the listener identifier returned by
427 * vlc_playlist_AddListener()
428 */
429VLC_API void
432
433/**
434 * Setup an action when a media is stopped
435 *
436 * @param playlist the playlist, locked
437 * @param action action to do when a media is stopped
438 */
439VLC_API void
442
443/**
444 * Return the number of items.
445 *
446 * \param playlist the playlist, locked
447 */
448VLC_API size_t
450
451/**
452 * Return the item at a given index.
453 *
454 * The index must be in range (less than vlc_playlist_Count()).
455 *
456 * \param playlist the playlist, locked
457 * \param index the index
458 * \return the playlist item
459 */
461vlc_playlist_Get(vlc_playlist_t *playlist, size_t index);
462
463/**
464 * Clear the playlist.
465 *
466 * \param playlist the playlist, locked
467 */
468VLC_API void
470
471/**
472 * Insert a list of media at a given index.
473 *
474 * The index must be in range (less than or equal to vlc_playlist_Count()).
475 *
476 * \param playlist the playlist, locked
477 * \param index the index where the media are to be inserted
478 * \param media the array of media to insert
479 * \param count the number of media to insert
480 * \return VLC_SUCCESS on success, another value on error
481 */
482VLC_API int
483vlc_playlist_Insert(vlc_playlist_t *playlist, size_t index,
484 input_item_t *const media[], size_t count);
485
486/**
487 * Insert a media at a given index.
488 *
489 * The index must be in range (less than or equal to vlc_playlist_Count()).
490 *
491 * \param playlist the playlist, locked
492 * \param index the index where the media is to be inserted
493 * \param media the media to insert
494 * \return VLC_SUCCESS on success, another value on error
495 */
496static inline int
497vlc_playlist_InsertOne(vlc_playlist_t *playlist, size_t index,
499{
500 return vlc_playlist_Insert(playlist, index, &media, 1);
501}
502
503/**
504 * Add a list of media at the end of the playlist.
505 *
506 * \param playlist the playlist, locked
507 * \param media the array of media to append
508 * \param count the number of media to append
509 * \return VLC_SUCCESS on success, another value on error
510 */
511static inline int
512vlc_playlist_Append(vlc_playlist_t *playlist, input_item_t *const media[],
513 size_t count)
514{
515 size_t size = vlc_playlist_Count(playlist);
516 return vlc_playlist_Insert(playlist, size, media, count);
517}
518
519/**
520 * Add a media at the end of the playlist.
521 *
522 * \param playlist the playlist, locked
523 * \param media the media to append
524 * \return VLC_SUCCESS on success, another value on error
525 */
526static inline int
529 return vlc_playlist_Append(playlist, &media, 1);
530}
531
532/**
533 * Move a slice of items to a given target index.
534 *
535 * The slice and the target must be in range (both index+count and target+count
536 * less than or equal to vlc_playlist_Count()).
537 *
538 * \param playlist the playlist, locked
539 * \param index the index of the first item to move
540 * \param count the number of items to move
541 * \param target the new index of the moved slice
542 */
543VLC_API void
544vlc_playlist_Move(vlc_playlist_t *playlist, size_t index, size_t count,
545 size_t target);
546
547/**
548 * Move an item to a given target index.
549 *
550 * The index and the target must be in range (index less than, and target less
551 * than or equal to, vlc_playlist_Count()).
552 *
553 * \param playlist the playlist, locked
554 * \param index the index of the item to move
555 * \param target the new index of the moved item
556 */
557static inline void
558vlc_playlist_MoveOne(vlc_playlist_t *playlist, size_t index, size_t target)
560 vlc_playlist_Move(playlist, index, 1, target);
561}
562
563/**
564 * Remove a slice of items at a given index.
565 *
566 * The slice must be in range (index+count less than or equal to
567 * vlc_playlist_Count()).
568 *
569 * \param playlist the playlist, locked
570 * \param index the index of the first item to remove
571 * \param count the number of items to remove
572 */
573VLC_API void
574vlc_playlist_Remove(vlc_playlist_t *playlist, size_t index, size_t count);
575
576/**
577 * Remove an item at a given index.
578 *
579 * The index must be in range (less than vlc_playlist_Count()).
580 *
581 * \param playlist the playlist, locked
582 * \param index the index of the item to remove
583 */
584static inline void
585vlc_playlist_RemoveOne(vlc_playlist_t *playlist, size_t index)
587 vlc_playlist_Remove(playlist, index, 1);
588}
589
590/**
591 * Insert a list of media at a given index (if in range), or append.
592 *
593 * Contrary to vlc_playlist_Insert(), the index need not be in range: if it is
594 * out of bounds, items will be appended.
595 *
596 * This is an helper to apply a desynchronized insert request, i.e. the
597 * playlist content may have changed since the request had been submitted.
598 * This is typically the case for user requests (e.g. from UI), because the
599 * playlist lock has to be acquired *after* the user requested the
600 * change.
601 *
602 * \param playlist the playlist, locked
603 * \param index the index where the media are to be inserted
604 * \param media the array of media to insert
605 * \param count the number of media to insert
606 * \return VLC_SUCCESS on success, another value on error
607 */
608VLC_API int
609vlc_playlist_RequestInsert(vlc_playlist_t *playlist, size_t index,
610 input_item_t *const media[], size_t count);
611
612/**
613 * Move a slice of items by value.
614 *
615 * If the indices are known, use vlc_playlist_Move() instead.
616 *
617 * This is an helper to apply a desynchronized move request, i.e. the playlist
618 * content may have changed since the request had been submitted. This is
619 * typically the case for user requests (e.g. from UI), because the playlist
620 * lock has to be acquired *after* the user requested the change.
621 *
622 * For optimization purpose, it is possible to pass an `index_hint`, which is
623 * the expected index of the first item of the slice (as known by the client).
624 * Hopefully, the index should often match, since conflicts are expected to be
625 * rare. Pass -1 not to pass any hint.
626 *
627 * \param playlist the playlist, locked
628 * \param items the array of items to move
629 * \param count the number of items to move
630 * \param target the new index of the moved slice
631 * \param index_hint the expected index of the first item (-1 for none)
632 * \return VLC_SUCCESS on success, another value on error
633 */
634VLC_API int
636 vlc_playlist_item_t *const items[], size_t count,
637 size_t target, ssize_t index_hint);
638
639/**
640 * Remove a slice of items by value.
641 *
642 * If the indices are known, use vlc_playlist_Remove() instead.
643 *
644 * This is an helper to apply a desynchronized remove request, i.e. the
645 * playlist content may have changed since the request had been submitted.
646 * This is typically the case for user requests (e.g. from UI), because the
647 * playlist lock has to be acquired *after* the user requested the change.
648 *
649 * For optimization purpose, it is possible to pass an `index_hint`, which is
650 * the expected index of the first item of the slice (as known by the client).
651 * Hopefully, the index should often match, since conflicts are expected to be
652 * rare. Pass -1 not to pass any hint.
653 *
654 * \param playlist the playlist, locked
655 * \param items the array of items to remove
656 * \param count the number of items to remove
657 * \param index_hint the expected index of the first item (-1 for none)
658 * \return VLC_SUCCESS on success, another value on error
659 */
660VLC_API int
662 vlc_playlist_item_t *const items[], size_t count,
663 ssize_t index_hint);
664
665/**
666 * Shuffle the playlist.
667 *
668 * \param playlist the playlist, locked
669 */
670VLC_API void
672
673/**
674 * Sort the playlist by a list of criteria.
675 *
676 * \param playlist the playlist, locked
677 * \param criteria the sort criteria (in order)
678 * \param count the number of criteria
679 * \return VLC_SUCCESS on success, another value on error
680 */
681VLC_API int
683 const struct vlc_playlist_sort_criterion criteria[],
684 size_t count);
685
686/**
687 * Return the index of a given item.
688 *
689 * \param playlist the playlist, locked
690 * \param item the item to locate
691 * \return the index of the item (-1 if not found)
692 */
693VLC_API ssize_t
695
696/**
697 * Return the index of a given media.
698 *
699 * \param playlist the playlist, locked
700 * \param media the media to locate
701 * \return the index of the playlist item containing the media (-1 if not found)
702 */
703VLC_API ssize_t
705
706/**
707 * Return the index of a given item id.
708 *
709 * \param playlist the playlist, locked
710 * \param id the id to locate
711 * \return the index of the playlist item having the id (-1 if not found)
712 */
713VLC_API ssize_t
714vlc_playlist_IndexOfId(vlc_playlist_t *playlist, uint64_t id);
715
716/**
717 * Return the playback "repeat" mode.
718 *
719 * \param playlist the playlist, locked
720 * \return the playback "repeat" mode
721 */
724
725/**
726 * Return the playback order.
727 *
728 * \param playlist the playlist, locked
729 * \return the playback order
730 */
733
734/**
735 * Change the playback "repeat" mode.
736 *
737 * \param playlist the playlist, locked
738 * \param repeat the new playback "repeat" mode
739 */
740VLC_API void
742 enum vlc_playlist_playback_repeat repeat);
743
744/**
745 * Change the playback order
746 *
747 * \param playlist the playlist, locked
748 * \param order the new playback order
749 */
750VLC_API void
752 enum vlc_playlist_playback_order order);
753
754/**
755 * Return the index of the current item.
756 *
757 * \param playlist the playlist, locked
758 * \return the index of the current item, -1 if none.
759 */
760VLC_API ssize_t
762
763/**
764 * Indicate whether a previous item is available.
765 *
766 * \param playlist the playlist, locked
767 * \retval true if a previous item is available
768 * \retval false if no previous item is available
769 */
770VLC_API bool
772
773/**
774 * Indicate whether a next item is available.
775 *
776 * \param playlist the playlist, locked
777 * \retval true if a next item is available
778 * \retval false if no next item is available
779 */
780VLC_API bool
782
783/**
784 * Go to the previous item.
785 *
786 * Return VLC_EGENERIC if vlc_playlist_HasPrev() returns false.
787 *
788 * \param playlist the playlist, locked
789 * \return VLC_SUCCESS on success, another value on error
790 */
791VLC_API int
793
794/**
795 * Go to the next item.
796 *
797 * Return VLC_EGENERIC if vlc_playlist_HasNext() returns false.
798 *
799 * \param playlist the playlist, locked
800 * \return VLC_SUCCESS on success, another value on error
801 */
802VLC_API int
804
805/**
806 * Go to a given index.
807 *
808 * the index must be -1 or in range (less than vlc_playlist_Count()).
809 *
810 * \param playlist the playlist, locked
811 * \param index the index to go to (-1 to none)
812 * \return VLC_SUCCESS on success, another value on error
813 */
814VLC_API int
815vlc_playlist_GoTo(vlc_playlist_t *playlist, ssize_t index);
816
817/**
818 * Go to a given item.
819 *
820 * If the index is known, use vlc_playlist_GoTo() instead.
821 *
822 * This is a helper to apply a desynchronized "go to" request, i.e. the
823 * playlist content may have changed since the request had been submitted.
824 * This is typically the case for user requests (e.g. from UI), because the
825 * playlist lock has to be acquired *after* the user requested the change.
826 *
827 * For optimization purpose, it is possible to pass an `index_hint`, which is
828 * the expected index of the first item of the slice (as known by the client).
829 * Hopefully, the index should often match, since conflicts are expected to be
830 * rare. Pass -1 not to pass any hint.
831 *
832 * \param playlist the playlist, locked
833 * \param item the item to go to (NULL for none)
834 * \param index_hint the expected index of the item (-1 for none)
835 * \return VLC_SUCCESS on success, another value on error
836 */
837VLC_API int
839 ssize_t index_hint);
840
841/**
842 * Return the player owned by the playlist.
843 *
844 * \param playlist the playlist (not necessarily locked)
845 * \return the player
846 */
849
850/**
851 * Start the player.
852 *
853 * \param playlist the playlist, locked
854 * \return VLC_SUCCESS on success, another value on error
855 */
856VLC_API int
858
859/**
860 * Stop the player.
861 *
862 * \param playlist the playlist, locked
863 */
864VLC_API void
866
867/**
868 * Pause the player.
869 *
870 * \param playlist the playlist, locked
871 */
872VLC_API void
874
875/**
876 * Resume the player.
877 *
878 * \param playlist the playlist, locked
879 */
880VLC_API void
882
883/**
884 * Go to the given index and plays the corresponding item.
885 *
886 * \param playlist the playlist, locked
887 * \param index the index to play at
888 * \return VLC_SUCCESS on success, another value on error
889 */
890static inline int
891vlc_playlist_PlayAt(vlc_playlist_t *playlist, size_t index)
893 int ret = vlc_playlist_GoTo(playlist, index);
894 if (ret != VLC_SUCCESS)
895 return ret;
896 return vlc_playlist_Start(playlist);
897}
898
899/**
900 * Preparse a media, and expand it in the playlist on subitems added.
901 *
902 * \param playlist the playlist (not necessarily locked)
903 * \param media the media to preparse
904 * \param parse_subitems true to parse subitems (from a folder or a playlist file)
905 */
906VLC_API void
908 bool parse_subitems);
909
910/**
911 * Export the playlist to a file.
912 *
913 * \param playlist a playlist instance
914 * \param filename the location where the exported file will be saved
915 * \param type the type of the playlist file to create (m3u, m3u8, xspf, ...)
916 * \return VLC_SUCCESS on success, another value on error
917 */
918// XXX use vlc_memstream instead of filename?
919VLC_API int
920vlc_playlist_Export(vlc_playlist_t *playlist, const char *filename,
921 const char *type);
922
923/** @} */
924# ifdef __cplusplus
925}
926# endif
927
928#endif
size_t count
Definition core.c:403
#define VLC_USED
Definition fourcc_gen.c:32
#define VLC_API
Definition fourcc_gen.c:31
#define VLC_SUCCESS
No error.
Definition vlc_common.h:478
int vlc_playlist_Next(vlc_playlist_t *playlist)
Go to the next item.
Definition control.c:376
void vlc_playlist_SetMediaStoppedAction(vlc_playlist_t *playlist, enum vlc_playlist_media_stopped_action action)
Setup an action when a media is stopped.
Definition player.c:203
ssize_t vlc_playlist_IndexOfMedia(vlc_playlist_t *playlist, const input_item_t *media)
Return the index of a given media.
Definition content.c:208
vlc_playlist_t * vlc_playlist_New(vlc_object_t *parent)
Create a new playlist.
Definition playlist.c:34
bool vlc_playlist_HasPrev(vlc_playlist_t *playlist)
Indicate whether a previous item is available.
Definition control.c:334
ssize_t vlc_playlist_IndexOf(vlc_playlist_t *playlist, const vlc_playlist_item_t *item)
Return the index of a given item.
Definition content.c:198
static int vlc_playlist_AppendOne(vlc_playlist_t *playlist, input_item_t *media)
Add a media at the end of the playlist.
Definition vlc_playlist.h:528
vlc_playlist_sort_key
Definition vlc_playlist.h:130
void vlc_playlist_SetPlaybackOrder(vlc_playlist_t *playlist, enum vlc_playlist_playback_order order)
Change the playback order.
Definition control.c:140
vlc_playlist_item_t * vlc_playlist_Get(vlc_playlist_t *playlist, size_t index)
Return the item at a given index.
Definition content.c:191
int vlc_playlist_Start(vlc_playlist_t *playlist)
Start the player.
Definition player.c:179
static int vlc_playlist_InsertOne(vlc_playlist_t *playlist, size_t index, input_item_t *media)
Insert a media at a given index.
Definition vlc_playlist.h:498
void vlc_playlist_Lock(vlc_playlist_t *)
Lock the playlist/player.
Definition playlist.c:92
void vlc_playlist_Delete(vlc_playlist_t *)
Delete a playlist.
Definition playlist.c:81
void vlc_playlist_Resume(vlc_playlist_t *playlist)
Resume the player.
Definition player.c:197
vlc_player_t * vlc_playlist_GetPlayer(vlc_playlist_t *playlist)
Return the player owned by the playlist.
Definition player.c:173
void vlc_playlist_Shuffle(vlc_playlist_t *playlist)
Shuffle the playlist.
Definition shuffle.c:33
vlc_playlist_media_stopped_action
Action when a media is stopped.
Definition vlc_playlist.h:163
ssize_t vlc_playlist_IndexOfId(vlc_playlist_t *playlist, uint64_t id)
Return the index of a given item id.
Definition content.c:220
enum vlc_playlist_playback_order vlc_playlist_GetPlaybackOrder(vlc_playlist_t *playlist)
Return the playback order.
Definition control.c:120
enum vlc_playlist_playback_repeat vlc_playlist_GetPlaybackRepeat(vlc_playlist_t *playlist)
Return the playback "repeat" mode.
Definition control.c:113
ssize_t vlc_playlist_GetCurrentIndex(vlc_playlist_t *playlist)
Return the index of the current item.
Definition control.c:314
int vlc_playlist_RequestInsert(vlc_playlist_t *playlist, size_t index, input_item_t *const media[], size_t count)
Insert a list of media at a given index (if in range), or append.
Definition request.c:31
static int vlc_playlist_PlayAt(vlc_playlist_t *playlist, size_t index)
Go to the given index and plays the corresponding item.
Definition vlc_playlist.h:892
vlc_playlist_listener_id * vlc_playlist_AddListener(vlc_playlist_t *playlist, const struct vlc_playlist_callbacks *cbs, void *userdata, bool notify_current_state)
Add a playlist listener.
Definition notify.c:51
void vlc_playlist_item_Release(vlc_playlist_item_t *)
Release a playlist item.
Definition item.c:51
void vlc_playlist_Stop(vlc_playlist_t *playlist)
Stop the player.
Definition player.c:185
bool vlc_playlist_HasNext(vlc_playlist_t *playlist)
Indicate whether a next item is available.
Definition control.c:341
int vlc_playlist_GoTo(vlc_playlist_t *playlist, ssize_t index)
Go to a given index.
Definition control.c:402
void vlc_playlist_Unlock(vlc_playlist_t *)
Unlock the playlist/player.
Definition playlist.c:98
int vlc_playlist_Export(vlc_playlist_t *playlist, const char *filename, const char *type)
Export the playlist to a file.
Definition export.c:55
vlc_playlist_playback_repeat
Definition vlc_playlist.h:117
void vlc_playlist_Move(vlc_playlist_t *playlist, size_t index, size_t count, size_t target)
Move a slice of items to a given target index.
Definition content.c:294
int vlc_playlist_RequestMove(vlc_playlist_t *playlist, vlc_playlist_item_t *const items[], size_t count, size_t target, ssize_t index_hint)
Move a slice of items by value.
Definition request.c:205
void vlc_playlist_Preparse(vlc_playlist_t *playlist, input_item_t *media, bool parse_subitems)
Preparse a media, and expand it in the playlist on subitems added.
Definition preparse.c:115
int vlc_playlist_Insert(vlc_playlist_t *playlist, size_t index, input_item_t *const media[], size_t count)
Insert a list of media at a given index.
Definition content.c:267
void vlc_playlist_Clear(vlc_playlist_t *playlist)
Clear the playlist.
Definition content.c:232
static void vlc_playlist_RemoveOne(vlc_playlist_t *playlist, size_t index)
Remove an item at a given index.
Definition vlc_playlist.h:586
int vlc_playlist_Prev(vlc_playlist_t *playlist)
Go to the previous item.
Definition control.c:348
input_item_t * vlc_playlist_item_GetMedia(vlc_playlist_item_t *)
Return the media associated to the playlist item.
Definition item.c:61
int vlc_playlist_Sort(vlc_playlist_t *playlist, const struct vlc_playlist_sort_criterion criteria[], size_t count)
Sort the playlist by a list of criteria.
Definition sort.c:445
void vlc_playlist_RemoveListener(vlc_playlist_t *playlist, vlc_playlist_listener_id *id)
Remove a player listener.
Definition notify.c:72
void vlc_playlist_Remove(vlc_playlist_t *playlist, size_t index, size_t count)
Remove a slice of items at a given index.
Definition content.c:308
uint64_t vlc_playlist_item_GetId(vlc_playlist_item_t *)
Return a unique id for the playlist item instance.
Definition item.c:67
int vlc_playlist_RequestRemove(vlc_playlist_t *playlist, vlc_playlist_item_t *const items[], size_t count, ssize_t index_hint)
Remove a slice of items by value.
Definition request.c:235
vlc_playlist_playback_order
Definition vlc_playlist.h:124
void vlc_playlist_item_Hold(vlc_playlist_item_t *)
Hold a playlist item.
Definition item.c:45
int vlc_playlist_RequestGoTo(vlc_playlist_t *playlist, vlc_playlist_item_t *item, ssize_t index_hint)
Go to a given item.
Definition request.c:260
vlc_playlist_sort_order
Definition vlc_playlist.h:147
static int vlc_playlist_Append(vlc_playlist_t *playlist, input_item_t *const media[], size_t count)
Add a list of media at the end of the playlist.
Definition vlc_playlist.h:513
void vlc_playlist_SetPlaybackRepeat(vlc_playlist_t *playlist, enum vlc_playlist_playback_repeat repeat)
Change the playback "repeat" mode.
Definition control.c:127
size_t vlc_playlist_Count(vlc_playlist_t *playlist)
Return the number of items.
Definition content.c:184
static void vlc_playlist_MoveOne(vlc_playlist_t *playlist, size_t index, size_t target)
Move an item to a given target index.
Definition vlc_playlist.h:559
void vlc_playlist_Pause(vlc_playlist_t *playlist)
Pause the player.
Definition player.c:191
@ VLC_PLAYLIST_SORT_KEY_DATE
Definition vlc_playlist.h:137
@ VLC_PLAYLIST_SORT_KEY_RATING
Definition vlc_playlist.h:141
@ VLC_PLAYLIST_SORT_KEY_DISC_NUMBER
Definition vlc_playlist.h:139
@ VLC_PLAYLIST_SORT_KEY_FILE_MODIFIED
Definition vlc_playlist.h:143
@ VLC_PLAYLIST_SORT_KEY_DURATION
Definition vlc_playlist.h:132
@ VLC_PLAYLIST_SORT_KEY_ARTIST
Definition vlc_playlist.h:133
@ VLC_PLAYLIST_SORT_KEY_TRACK_NUMBER
Definition vlc_playlist.h:138
@ VLC_PLAYLIST_SORT_KEY_GENRE
Definition vlc_playlist.h:136
@ VLC_PLAYLIST_SORT_KEY_ALBUM
Definition vlc_playlist.h:134
@ VLC_PLAYLIST_SORT_KEY_ALBUM_ARTIST
Definition vlc_playlist.h:135
@ VLC_PLAYLIST_SORT_KEY_URL
Definition vlc_playlist.h:140
@ VLC_PLAYLIST_SORT_KEY_TITLE
Definition vlc_playlist.h:131
@ VLC_PLAYLIST_SORT_KEY_FILE_SIZE
Definition vlc_playlist.h:142
@ VLC_PLAYLIST_MEDIA_STOPPED_EXIT
Exit VLC.
Definition vlc_playlist.h:171
@ VLC_PLAYLIST_MEDIA_STOPPED_STOP
Stop, even if there is a next media to play.
Definition vlc_playlist.h:169
@ VLC_PLAYLIST_MEDIA_STOPPED_CONTINUE
Continue (or stop if there is no next media), default behavior.
Definition vlc_playlist.h:165
@ VLC_PLAYLIST_MEDIA_STOPPED_PAUSE
Pause when reaching the end of file.
Definition vlc_playlist.h:167
@ VLC_PLAYLIST_PLAYBACK_REPEAT_NONE
Definition vlc_playlist.h:118
@ VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT
Definition vlc_playlist.h:119
@ VLC_PLAYLIST_PLAYBACK_REPEAT_ALL
Definition vlc_playlist.h:120
@ VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM
Definition vlc_playlist.h:126
@ VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL
Definition vlc_playlist.h:125
@ VLC_PLAYLIST_SORT_ORDER_ASCENDING
Definition vlc_playlist.h:148
@ VLC_PLAYLIST_SORT_ORDER_DESCENDING
Definition vlc_playlist.h:149
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
VLC object common members.
Definition vlc_objects.h:53
Definition player.h:236
Playlist callbacks.
Definition vlc_playlist.h:183
void(* on_items_updated)(vlc_playlist_t *playlist, size_t index, vlc_playlist_item_t *const items[], size_t count, void *userdata)
Called when an item has been updated via (pre-)parsing.
Definition vlc_playlist.h:245
void(* on_playback_repeat_changed)(vlc_playlist_t *playlist, enum vlc_playlist_playback_repeat repeat, void *userdata)
Called when the playback repeat mode has been changed.
Definition vlc_playlist.h:257
void(* on_items_added)(vlc_playlist_t *playlist, size_t index, vlc_playlist_item_t *const items[], size_t count, void *userdata)
Called when items have been added to the playlist.
Definition vlc_playlist.h:207
void(* on_current_index_changed)(vlc_playlist_t *playlist, ssize_t index, void *userdata)
Called when the current item index has changed.
Definition vlc_playlist.h:284
void(* on_has_next_changed)(vlc_playlist_t *playlist, bool has_next, void *userdata)
Called when the "has next item" property has changed.
Definition vlc_playlist.h:310
void(* on_items_moved)(vlc_playlist_t *playlist, size_t index, size_t count, size_t target, void *userdata)
Called when a slice of items have been moved.
Definition vlc_playlist.h:221
void(* on_items_removed)(vlc_playlist_t *playlist, size_t index, size_t count, void *userdata)
Called when a slice of items have been removed from the playlist.
Definition vlc_playlist.h:232
void(* on_playback_order_changed)(vlc_playlist_t *playlist, enum vlc_playlist_playback_order order, void *userdata)
Called when the playback order mode has been changed.
Definition vlc_playlist.h:269
void(* on_media_stopped_action_changed)(vlc_playlist_t *playlist, enum vlc_playlist_media_stopped_action new_action, void *userdata)
Called when the stopped action has changed.
Definition vlc_playlist.h:322
void(* on_items_reset)(vlc_playlist_t *, vlc_playlist_item_t *const items[], size_t count, void *userdata)
Called when the whole content has changed (e.g.
Definition vlc_playlist.h:194
void(* on_has_prev_changed)(vlc_playlist_t *playlist, bool has_prev, void *userdata)
Called when the "has previous item" property has changed.
Definition vlc_playlist.h:297
Definition item.h:30
Definition notify.h:30
Definition vlc_playlist.h:153
enum vlc_playlist_sort_key key
Definition vlc_playlist.h:154
enum vlc_playlist_sort_order order
Definition vlc_playlist.h:155
Definition playlist.h:55
This file is a collection of common definitions and types.