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