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 /** Stop, even if there is a next media to play */
181 /** Exit VLC */
184
185/**
186 * Playlist callbacks.
187 *
188 * A client may register a listener using vlc_playlist_AddListener() to listen
189 * playlist events.
190 *
191 * All callbacks are called with the playlist locked (see vlc_playlist_Lock()).
192 */
195 /**
196 * Called when the whole content has changed (e.g. when the playlist has
197 * been cleared, shuffled or sorted).
198 *
199 * \param playlist the playlist
200 * \param items the whole new content of the playlist
201 * \param count the number of items
202 * \param userdata userdata provided to AddListener()
203 */
204 void
206 size_t count, void *userdata);
207
208 /**
209 * Called when items have been added to the playlist.
210 *
211 * \param playlist the playlist
212 * \param index the index of the insertion
213 * \param items the array of added items
214 * \param count the number of items added
215 * \param userdata userdata provided to AddListener()
216 */
217 void
218 (*on_items_added)(vlc_playlist_t *playlist, size_t index,
219 vlc_playlist_item_t *const items[], size_t count,
220 void *userdata);
221
222 /**
223 * Called when a slice of items have been moved.
224 *
225 * \param playlist the playlist
226 * \param index the index of the first moved item
227 * \param count the number of items moved
228 * \param target the new index of the moved slice
229 * \param userdata userdata provided to AddListener()
230 */
231 void
232 (*on_items_moved)(vlc_playlist_t *playlist, size_t index, size_t count,
233 size_t target, void *userdata);
234 /**
235 * Called when a slice of items have been removed from the playlist.
236 *
237 * \param playlist the playlist
238 * \param index the index of the first removed item
239 * \param count the number of items removed
240 * \param userdata userdata provided to AddListener()
241 */
242 void
243 (*on_items_removed)(vlc_playlist_t *playlist, size_t index, size_t count,
244 void *userdata);
245
246 /**
247 * Called when an item has been updated via (pre-)parsing.
248 *
249 * \param playlist the playlist
250 * \param index the index of the first updated item
251 * \param items the array of updated items
252 * \param count the number of items updated
253 * \param userdata userdata provided to AddListener()
254 */
255 void
256 (*on_items_updated)(vlc_playlist_t *playlist, size_t index,
257 vlc_playlist_item_t *const items[], size_t count,
258 void *userdata);
259
260 /**
261 * Called when the playback repeat mode has been changed.
262 *
263 * \param playlist the playlist
264 * \param repeat the new playback "repeat" mode
265 * \param userdata userdata provided to AddListener()
266 */
267 void
270 void *userdata);
271
272 /**
273 * Called when the playback order mode has been changed.
274 *
275 * \param playlist the playlist
276 * \param rorder the new playback order
277 * \param userdata userdata provided to AddListener()
278 */
279 void
282 void *userdata);
283
284 /**
285 * Called when the current item index has changed.
286 *
287 * Note that the current item index may have changed while the current item
288 * is still the same: it may have been moved.
289 *
290 * \param playlist the playlist
291 * \param index the new current index (-1 if there is no current item)
292 * \param userdata userdata provided to AddListener()
293 */
294 void
295 (*on_current_index_changed)(vlc_playlist_t *playlist, ssize_t index,
296 void *userdata);
297
298 /**
299 * Called when the "has previous item" property has changed.
300 *
301 * This is typically useful to update any "previous" button in the UI.
302 *
303 * \param playlist the playlist
304 * \param has_prev true if there is a previous item, false otherwise
305 * \param userdata userdata provided to AddListener()
306 */
307 void
308 (*on_has_prev_changed)(vlc_playlist_t *playlist, bool has_prev,
309 void *userdata);
310
311 /**
312 * Called when the "has next item" property has changed.
313 *
314 * This is typically useful to update any "next" button in the UI.
315 *
316 * \param playlist the playlist
317 * \param has_next true if there is a next item, false otherwise
318 * \param userdata userdata provided to AddListener()
319 */
320 void
322 bool has_next, void *userdata);
323
324 /**
325 * Called when the stopped action has changed
326 *
327 * @see vlc_playlist_SetMediaStoppedAction()
328 *
329 * \param playlist the playlist
330 * @param new_action action to execute when a media is stopped
331 * \param userdata userdata provided to AddListener()
332 */
335 void *userdata);
336};
337
338/* Playlist items */
339
340/**
341 * Hold a playlist item.
342 *
343 * Increment the refcount of the playlist item.
344 */
345VLC_API void
347
348/**
349 * Release a playlist item.
350 *
351 * Decrement the refcount of the playlist item, and destroy it if necessary.
352 */
353VLC_API void
355
356/**
357 * Return the media associated to the playlist item.
358 */
361
362/**
363 * Return a unique id for the playlist item instance.
364 */
365VLC_API uint64_t
367
368/* Playlist */
369
370/**
371 * Create a new playlist.
372 *
373 * \param parent a VLC object
374 * \param rec preparsing depth
375 * \param preparse_max_threads the maximum number of threads used to parse, must be >= 1
376 * \param preparse_timeout default timeout of the preparser, 0 for no limits.
377 * \return a pointer to a valid playlist instance, or NULL if an error occurred
378 */
381 unsigned preparse_max_threads, vlc_tick_t preparse_timeout);
382
383/**
384 * Delete a playlist.
385 *
386 * All playlist items are released, and listeners are removed and destroyed.
387 */
388VLC_API void
390
391/**
392 * Lock the playlist/player.
393 *
394 * The playlist and its player share the same lock, to avoid lock-order
395 * inversion issues.
396 *
397 * \warning Do not forget that the playlist and player lock are the same (or
398 * you could lock twice the same and deadlock).
399 *
400 * Almost all playlist functions must be called with lock held (check their
401 * description).
402 *
403 * The lock is not recursive.
404 */
405VLC_API void
407
408/**
409 * Unlock the playlist/player.
410 */
411VLC_API void
413
414/**
415 * Add a playlist listener.
416 *
417 * Return an opaque listener identifier, to be passed to
418 * vlc_player_RemoveListener().
419 *
420 * If notify_current_state is true, the callbacks are called once with the
421 * current state of the playlist. This is useful because when a client
422 * registers to the playlist, it may already contain items. Calling callbacks
423 * is a convenient way to initialize the client automatically.
424 *
425 * \param playlist the playlist, locked
426 * \param cbs the callbacks (must be valid until the listener
427 * is removed)
428 * \param userdata userdata provided as a parameter in callbacks
429 * \param notify_current_state true to notify the current state immediately via
430 * callbacks
431 * \return a listener identifier, or NULL if an error occurred
432 */
435 const struct vlc_playlist_callbacks *cbs,
436 void *userdata, bool notify_current_state);
437
438/**
439 * Remove a player listener.
440 *
441 * \param playlist the playlist, locked
442 * \param id the listener identifier returned by
443 * vlc_playlist_AddListener()
444 */
445VLC_API void
448
449/**
450 * Setup an action when a media is stopped
451 *
452 * @param playlist the playlist, locked
453 * @param action action to do when a media is stopped
454 */
455VLC_API void
458
459/**
460 * Return the number of items.
461 *
462 * \param playlist the playlist, locked
463 */
464VLC_API size_t
466
467/**
468 * Return the item at a given index.
469 *
470 * The index must be in range (less than vlc_playlist_Count()).
471 *
472 * \param playlist the playlist, locked
473 * \param index the index
474 * \return the playlist item
475 */
477vlc_playlist_Get(vlc_playlist_t *playlist, size_t index);
478
479/**
480 * Clear the playlist.
481 *
482 * \param playlist the playlist, locked
483 */
484VLC_API void
486
487/**
488 * Insert a list of media at a given index.
489 *
490 * The index must be in range (less than or equal to vlc_playlist_Count()).
491 *
492 * \param playlist the playlist, locked
493 * \param index the index where the media are to be inserted
494 * \param media the array of media to insert
495 * \param count the number of media to insert
496 * \return VLC_SUCCESS on success, another value on error
497 */
498VLC_API int
499vlc_playlist_Insert(vlc_playlist_t *playlist, size_t index,
500 input_item_t *const media[], size_t count);
501
502/**
503 * Insert a media at a given index.
504 *
505 * The index must be in range (less than or equal to vlc_playlist_Count()).
506 *
507 * \param playlist the playlist, locked
508 * \param index the index where the media is to be inserted
509 * \param media the media to insert
510 * \return VLC_SUCCESS on success, another value on error
511 */
512static inline int
513vlc_playlist_InsertOne(vlc_playlist_t *playlist, size_t index,
515{
516 return vlc_playlist_Insert(playlist, index, &media, 1);
517}
518
519/**
520 * Add a list of media at the end of the playlist.
521 *
522 * \param playlist the playlist, locked
523 * \param media the array of media to append
524 * \param count the number of media to append
525 * \return VLC_SUCCESS on success, another value on error
526 */
527static inline int
528vlc_playlist_Append(vlc_playlist_t *playlist, input_item_t *const media[],
529 size_t count)
530{
531 size_t size = vlc_playlist_Count(playlist);
532 return vlc_playlist_Insert(playlist, size, media, count);
533}
534
535/**
536 * Add a media at the end of the playlist.
537 *
538 * \param playlist the playlist, locked
539 * \param media the media to append
540 * \return VLC_SUCCESS on success, another value on error
541 */
542static inline int
545 return vlc_playlist_Append(playlist, &media, 1);
546}
547
548/**
549 * Move a slice of items to a given target index.
550 *
551 * The slice and the target must be in range (both index+count and target+count
552 * less than or equal to vlc_playlist_Count()).
553 *
554 * \param playlist the playlist, locked
555 * \param index the index of the first item to move
556 * \param count the number of items to move
557 * \param target the new index of the moved slice
558 */
559VLC_API void
560vlc_playlist_Move(vlc_playlist_t *playlist, size_t index, size_t count,
561 size_t target);
562
563/**
564 * Move an item to a given target index.
565 *
566 * The index and the target must be in range (index less than, and target less
567 * than or equal to, vlc_playlist_Count()).
568 *
569 * \param playlist the playlist, locked
570 * \param index the index of the item to move
571 * \param target the new index of the moved item
572 */
573static inline void
574vlc_playlist_MoveOne(vlc_playlist_t *playlist, size_t index, size_t target)
576 vlc_playlist_Move(playlist, index, 1, target);
577}
578
579/**
580 * Remove a slice of items at a given index.
581 *
582 * The slice must be in range (index+count less than or equal to
583 * vlc_playlist_Count()).
584 *
585 * \param playlist the playlist, locked
586 * \param index the index of the first item to remove
587 * \param count the number of items to remove
588 */
589VLC_API void
590vlc_playlist_Remove(vlc_playlist_t *playlist, size_t index, size_t count);
591
592/**
593 * Remove an item at a given index.
594 *
595 * The index must be in range (less than vlc_playlist_Count()).
596 *
597 * \param playlist the playlist, locked
598 * \param index the index of the item to remove
599 */
600static inline void
601vlc_playlist_RemoveOne(vlc_playlist_t *playlist, size_t index)
603 vlc_playlist_Remove(playlist, index, 1);
604}
605
606/**
607 * Insert a list of media at a given index (if in range), or append.
608 *
609 * Contrary to vlc_playlist_Insert(), the index need not be in range: if it is
610 * out of bounds, items will be appended.
611 *
612 * This is an helper to apply a desynchronized insert request, i.e. the
613 * playlist content may have changed since the request had been submitted.
614 * This is typically the case for user requests (e.g. from UI), because the
615 * playlist lock has to be acquired *after* the user requested the
616 * change.
617 *
618 * \param playlist the playlist, locked
619 * \param index the index where the media are to be inserted
620 * \param media the array of media to insert
621 * \param count the number of media to insert
622 * \return VLC_SUCCESS on success, another value on error
623 */
624VLC_API int
625vlc_playlist_RequestInsert(vlc_playlist_t *playlist, size_t index,
626 input_item_t *const media[], size_t count);
627
628/**
629 * Move a slice of items by value.
630 *
631 * If the indices are known, use vlc_playlist_Move() instead.
632 *
633 * This is an helper to apply a desynchronized move request, i.e. the playlist
634 * content may have changed since the request had been submitted. This is
635 * typically the case for user requests (e.g. from UI), because the playlist
636 * lock has to be acquired *after* the user requested the change.
637 *
638 * For optimization purpose, it is possible to pass an `index_hint`, which is
639 * the expected index of the first item of the slice (as known by the client).
640 * Hopefully, the index should often match, since conflicts are expected to be
641 * rare. Pass -1 not to pass any hint.
642 *
643 * \param playlist the playlist, locked
644 * \param items the array of items to move
645 * \param count the number of items to move
646 * \param target the new index of the moved slice
647 * \param index_hint the expected index of the first item (-1 for none)
648 * \return VLC_SUCCESS on success, another value on error
649 */
650VLC_API int
652 vlc_playlist_item_t *const items[], size_t count,
653 size_t target, ssize_t index_hint);
654
655/**
656 * Remove a slice of items by value.
657 *
658 * If the indices are known, use vlc_playlist_Remove() instead.
659 *
660 * This is an helper to apply a desynchronized remove request, i.e. the
661 * playlist content may have changed since the request had been submitted.
662 * This is typically the case for user requests (e.g. from UI), because the
663 * playlist lock has to be acquired *after* the user requested the change.
664 *
665 * For optimization purpose, it is possible to pass an `index_hint`, which is
666 * the expected index of the first item of the slice (as known by the client).
667 * Hopefully, the index should often match, since conflicts are expected to be
668 * rare. Pass -1 not to pass any hint.
669 *
670 * \param playlist the playlist, locked
671 * \param items the array of items to remove
672 * \param count the number of items to remove
673 * \param index_hint the expected index of the first item (-1 for none)
674 * \return VLC_SUCCESS on success, another value on error
675 */
676VLC_API int
678 vlc_playlist_item_t *const items[], size_t count,
679 ssize_t index_hint);
680
681/**
682 * Shuffle the playlist.
683 *
684 * \param playlist the playlist, locked
685 */
686VLC_API void
688
689/**
690 * Sort the playlist by a list of criteria.
691 *
692 * \param playlist the playlist, locked
693 * \param criteria the sort criteria (in order)
694 * \param count the number of criteria
695 * \return VLC_SUCCESS on success, another value on error
696 */
697VLC_API int
699 const struct vlc_playlist_sort_criterion criteria[],
700 size_t count);
701
702/**
703 * Return the index of a given item.
704 *
705 * \param playlist the playlist, locked
706 * \param item the item to locate
707 * \return the index of the item (-1 if not found)
708 */
709VLC_API ssize_t
711
712/**
713 * Return the index of a given media.
714 *
715 * \param playlist the playlist, locked
716 * \param media the media to locate
717 * \return the index of the playlist item containing the media (-1 if not found)
718 */
719VLC_API ssize_t
721
722/**
723 * Return the index of a given item id.
724 *
725 * \param playlist the playlist, locked
726 * \param id the id to locate
727 * \return the index of the playlist item having the id (-1 if not found)
728 */
729VLC_API ssize_t
730vlc_playlist_IndexOfId(vlc_playlist_t *playlist, uint64_t id);
731
732/**
733 * Return the playback "repeat" mode.
734 *
735 * \param playlist the playlist, locked
736 * \return the playback "repeat" mode
737 */
740
741/**
742 * Return the playback order.
743 *
744 * \param playlist the playlist, locked
745 * \return the playback order
746 */
749
750/**
751 * Change the playback "repeat" mode.
752 *
753 * \param playlist the playlist, locked
754 * \param repeat the new playback "repeat" mode
755 */
756VLC_API void
758 enum vlc_playlist_playback_repeat repeat);
759
760/**
761 * Change the playback order
762 *
763 * \param playlist the playlist, locked
764 * \param order the new playback order
765 */
766VLC_API void
768 enum vlc_playlist_playback_order order);
769
770/**
771 * Return the index of the current item.
772 *
773 * \param playlist the playlist, locked
774 * \return the index of the current item, -1 if none.
775 */
776VLC_API ssize_t
778
779/**
780 * Indicate whether a previous item is available.
781 *
782 * \param playlist the playlist, locked
783 * \retval true if a previous item is available
784 * \retval false if no previous item is available
785 */
786VLC_API bool
788
789/**
790 * Indicate whether a next item is available.
791 *
792 * \param playlist the playlist, locked
793 * \retval true if a next item is available
794 * \retval false if no next item is available
795 */
796VLC_API bool
798
799/**
800 * Go to the previous item.
801 *
802 * Return VLC_EGENERIC if vlc_playlist_HasPrev() returns false.
803 *
804 * \param playlist the playlist, locked
805 * \return VLC_SUCCESS on success, another value on error
806 */
807VLC_API int
809
810/**
811 * Go to the next item.
812 *
813 * Return VLC_EGENERIC if vlc_playlist_HasNext() returns false.
814 *
815 * \param playlist the playlist, locked
816 * \return VLC_SUCCESS on success, another value on error
817 */
818VLC_API int
820
821/**
822 * Go to a given index.
823 *
824 * the index must be -1 or in range (less than vlc_playlist_Count()).
825 *
826 * \param playlist the playlist, locked
827 * \param index the index to go to (-1 to none)
828 * \return VLC_SUCCESS on success, another value on error
829 */
830VLC_API int
831vlc_playlist_GoTo(vlc_playlist_t *playlist, ssize_t index);
832
833/**
834 * Go to a given item.
835 *
836 * If the index is known, use vlc_playlist_GoTo() instead.
837 *
838 * This is a helper to apply a desynchronized "go to" request, i.e. the
839 * playlist content may have changed since the request had been submitted.
840 * This is typically the case for user requests (e.g. from UI), because the
841 * playlist lock has to be acquired *after* the user requested the change.
842 *
843 * For optimization purpose, it is possible to pass an `index_hint`, which is
844 * the expected index of the first item of the slice (as known by the client).
845 * Hopefully, the index should often match, since conflicts are expected to be
846 * rare. Pass -1 not to pass any hint.
847 *
848 * \param playlist the playlist, locked
849 * \param item the item to go to (NULL for none)
850 * \param index_hint the expected index of the item (-1 for none)
851 * \return VLC_SUCCESS on success, another value on error
852 */
853VLC_API int
855 ssize_t index_hint);
856
857/**
858 * Return the player owned by the playlist.
859 *
860 * \param playlist the playlist (not necessarily locked)
861 * \return the player
862 */
865
866/**
867 * Start the player.
868 *
869 * \param playlist the playlist, locked
870 * \return VLC_SUCCESS on success, another value on error
871 */
872VLC_API int
874
875/**
876 * Stop the player.
877 *
878 * \param playlist the playlist, locked
879 */
880VLC_API void
882
883/**
884 * Pause the player.
885 *
886 * \param playlist the playlist, locked
887 */
888VLC_API void
890
891/**
892 * Resume the player.
893 *
894 * \param playlist the playlist, locked
895 */
896VLC_API void
898
899/**
900 * Go to the given index and plays the corresponding item.
901 *
902 * \param playlist the playlist, locked
903 * \param index the index to play at
904 * \return VLC_SUCCESS on success, another value on error
905 */
906static inline int
907vlc_playlist_PlayAt(vlc_playlist_t *playlist, size_t index)
909 int ret = vlc_playlist_GoTo(playlist, index);
910 if (ret != VLC_SUCCESS)
911 return ret;
912 return vlc_playlist_Start(playlist);
913}
914
915/**
916 * Export the playlist to a file.
917 *
918 * \param playlist a playlist instance
919 * \param filename the location where the exported file will be saved
920 * \param type the type of the playlist file to create (m3u, m3u8, xspf, ...)
921 * \return VLC_SUCCESS on success, another value on error
922 */
923// XXX use vlc_memstream instead of filename?
924VLC_API int
925vlc_playlist_Export(vlc_playlist_t *playlist, const char *filename,
926 const char *type);
927
928/** @} */
929# ifdef __cplusplus
930}
931# endif
932
933#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:480
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:204
ssize_t vlc_playlist_IndexOfMedia(vlc_playlist_t *playlist, const input_item_t *media)
Return the index of a given media.
Definition content.c:209
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:199
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:544
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:192
int vlc_playlist_Start(vlc_playlist_t *playlist)
Start the player.
Definition player.c:180
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:514
void vlc_playlist_Lock(vlc_playlist_t *)
Lock the playlist/player.
Definition playlist.c:98
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:198
vlc_player_t * vlc_playlist_GetPlayer(vlc_playlist_t *playlist)
Return the player owned by the playlist.
Definition player.c:174
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:221
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:908
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:52
void vlc_playlist_Stop(vlc_playlist_t *playlist)
Stop the player.
Definition player.c:186
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:104
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:298
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:271
void vlc_playlist_Clear(vlc_playlist_t *playlist)
Clear the playlist.
Definition content.c:233
static void vlc_playlist_RemoveOne(vlc_playlist_t *playlist, size_t index)
Remove an item at a given index.
Definition vlc_playlist.h:602
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:62
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:312
uint64_t vlc_playlist_item_GetId(vlc_playlist_item_t *)
Return a unique id for the playlist item instance.
Definition item.c:68
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:46
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:529
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:185
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:575
void vlc_playlist_Pause(vlc_playlist_t *playlist)
Pause the player.
Definition player.c:192
@ 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:183
@ VLC_PLAYLIST_MEDIA_STOPPED_STOP
Stop, even if there is a next media to play.
Definition vlc_playlist.h:181
@ VLC_PLAYLIST_MEDIA_STOPPED_CONTINUE
Continue (or stop if there is no next media), default behavior.
Definition vlc_playlist.h:179
@ 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:242
Playlist callbacks.
Definition vlc_playlist.h:195
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:257
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:269
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:219
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:296
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:322
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:233
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:244
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:281
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:334
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:206
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:309
Definition item.h:31
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