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