VLC 4.0.0-dev
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
vlc_player.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_player.h: player interface
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_PLAYER_H
22#define VLC_PLAYER_H 1
23
24#include <vlc_input.h>
25#include <vlc_aout.h>
26
27/**
28 * @defgroup vlc_player Player
29 * @ingroup input
30 * VLC Player API
31 * @brief
32@dot
33digraph player_states {
34 label="Player state diagram";
35 new [style="invis"];
36 started [label="Started" URL="@ref VLC_PLAYER_STATE_STARTED"];
37 playing [label="Playing" URL="@ref VLC_PLAYER_STATE_PLAYING"];
38 paused [label="Paused" URL="@ref VLC_PLAYER_STATE_PAUSED"];
39 stopping [label="Stopping" URL="@ref VLC_PLAYER_STATE_STOPPING"];
40 stopped [label="Stopped" URL="@ref VLC_PLAYER_STATE_STOPPED"];
41 new -> stopped [label="vlc_player_New()" URL="@ref vlc_player_New" fontcolor="green3"];
42 started -> playing [style="dashed" label=<<i>internal transition</i>>];
43 started -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
44 playing -> paused [label="vlc_player_Pause()" URL="@ref vlc_player_Pause" fontcolor="blue"];
45 paused -> playing [label="vlc_player_Resume()" URL="@ref vlc_player_Resume" fontcolor="blue3"];
46 paused -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
47 playing -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
48 stopping -> stopped [style="dashed" label=<<i>internal transition</i>>];
49 stopped -> started [label="vlc_player_Start()" URL="@ref vlc_player_Start" fontcolor="darkgreen"];
50}
51@enddot
52 * @{
53 * @file
54 * VLC Player API
55 */
56
57/**
58 * @defgroup vlc_player__instance Player instance
59 * @{
60 */
61
62/**
63 * Player opaque structure.
64 */
65typedef struct vlc_player_t vlc_player_t;
67/**
68 * Player lock type (normal or reentrant)
69 */
72 /**
73 * Normal lock
74 *
75 * If the player is already locked, subsequent calls to vlc_player_Lock()
76 * will deadlock.
77 */
80 /**
81 * Reentrant lock
82 *
83 * If the player is already locked, subsequent calls to vlc_player_Lock()
84 * will still succeed. To unlock the player, one call to
85 * vlc_player_Unlock() per vlc_player_Lock() is necessary.
86 */
88};
89
90/**
91 * Create a new player instance
92 *
93 * @param parent parent VLC object
94 * @param lock_type whether the player lock is reentrant or not
95 * @param media_provider pointer to a media_provider structure or NULL, the
96 * structure must be valid during the lifetime of the player
97 * @param media_provider_data opaque data used by provider callbacks
98 * @return a pointer to a valid player instance or NULL in case of error
99 */
101vlc_player_New(vlc_object_t *parent, enum vlc_player_lock_type lock_type);
102
103/**
104 * Delete a player instance
105 *
106 * This function stop any playback previously started and wait for their
107 * termination.
108 *
109 * @warning Blocking function if the player state is not STOPPED, don't call it
110 * from an UI thread in that case.
111 *
112 * @param player unlocked player instance created by vlc_player_New()
113 */
114VLC_API void
116
117/**
118 * Lock the player.
119 *
120 * All player functions (except vlc_player_Delete()) need to be called while
121 * the player lock is held.
122 *
123 * @param player unlocked player instance
124 */
125VLC_API void
127
128/**
129 * Unlock the player
130 *
131 * @param player locked player instance
132 */
133VLC_API void
135
136/**
137 * Wait on a condition variable
138 *
139 * This call allow users to use their own condition with the player mutex.
140 *
141 * @param player locked player instance
142 * @param cond external condition
143 */
144VLC_API void
146
147/**
148 * Ask to start in a paused state
149 *
150 * This function can be used before vlc_player_Start()
151 *
152 * @param player locked player instance
153 * @param start_paused true to start in a paused state, false to cancel it
154 */
155VLC_API void
157
158/**
159 * Enable or disable pause on cork event
160 *
161 * If enabled, the player will automatically pause and resume on cork events.
162 * In that case, cork events won't be propagated via callbacks.
163 * @see vlc_player_cbs.on_cork_changed
164 *
165 * @param player locked player instance
166 * @param enabled true to enable
167 */
168VLC_API void
169vlc_player_SetPauseOnCork(vlc_player_t *player, bool enabled);
170
171/** @} vlc_player__instance */
172
173/**
174 * @defgroup vlc_player__playback Playback control
175 * @{
176 */
177
178/**
179 * State of the player
180 *
181 * During a normal playback (no errors), the user is expected to receive all
182 * events in the following order: STARTED, PLAYING, STOPPING, STOPPED.
183 *
184 * @note When playing more than one media in a row, the player stay at the
185 * PLAYING state when doing the transition from the current media to the next
186 * media (that can be gapless). This means that STOPPING, STOPPED states (for
187 * the current media) and STARTED, PLAYING states (for the next one) won't be
188 * sent. Nevertheless, the vlc_player_cbs.on_current_media_changed callback
189 * will be called during this transition.
190 */
193 /**
194 * The player is stopped
195 *
196 * Initial state, or triggered by an internal transition from the STOPPING
197 * state.
198 */
201 /**
202 * The player is started
203 *
204 * Triggered by vlc_player_Start()
205 */
208 /**
209 * The player is playing
210 *
211 * Triggered by vlc_player_Resume() or by an internal transition from the
212 * STARTED state.
213 */
216 /**
217 * The player is paused
218 *
219 * Triggered by vlc_player_Pause().
220 */
223 /**
224 * The player is stopping
225 *
226 * Triggered by vlc_player_Stop(), vlc_player_SetCurrentMedia() or by an
227 * internal transition (when the media reach the end of file for example).
228 */
231
232/**
233 * Error of the player
234 *
235 * @see vlc_player_GetError()
236 */
243/**
244 * Seek speed type
245 *
246 * @see vlc_player_SeekByPos()
247 * @see vlc_player_SeekByTime()
248 */
251 /** Do a precise seek */
253 /** Do a fast seek */
256
257/**
258 * Player seek/delay directive
259 *
260 * @see vlc_player_SeekByPos()
261 * @see vlc_player_SeekByTime()
262 * @see vlc_player_SetCategoryDelay()
263 */
266 /** Given time/position */
268 /** The current position +/- the given time/position */
271
272/**
273 * Menu (VCD/DVD/BD) and viewpoint navigations
274 *
275 * @see vlc_player_Navigate()
276 */
279 /** Activate the navigation item selected */
281 /** Select a navigation item above or move the viewpoint up */
283 /** Select a navigation item under or move the viewpoint down */
285 /** Select a navigation item on the left or move the viewpoint left */
287 /** Select a navigation item on the right or move the viewpoint right */
289 /** Activate the popup Menu (for BD) */
291 /** Activate disc Root Menu */
294
295/**
296 * A to B loop state
297 */
305/** Player capability: can seek */
306#define VLC_PLAYER_CAP_SEEK (1<<0)
307/** Player capability: can pause */
308#define VLC_PLAYER_CAP_PAUSE (1<<1)
309/** Player capability: can change the rate */
310#define VLC_PLAYER_CAP_CHANGE_RATE (1<<2)
311/** Player capability: can seek back */
312#define VLC_PLAYER_CAP_REWIND (1<<3)
314/** Player teletext key: Red */
315#define VLC_PLAYER_TELETEXT_KEY_RED ('r' << 16)
316/** Player teletext key: Green */
317#define VLC_PLAYER_TELETEXT_KEY_GREEN ('g' << 16)
318/** Player teletext key: Yellow */
319#define VLC_PLAYER_TELETEXT_KEY_YELLOW ('y' << 16)
320/** Player teletext key: Blue */
321#define VLC_PLAYER_TELETEXT_KEY_BLUE ('b' << 16)
322/** Player teletext key: Index */
323#define VLC_PLAYER_TELETEXT_KEY_INDEX ('i' << 16)
332/**
333 * Set the current media
334 *
335 * This function replaces the current and next medias.
336 *
337 * @note A successful call will always result of
338 * vlc_player_cbs.on_current_media_changed being called. This function is not
339 * blocking. If a media is currently being played, this media will be stopped
340 * and the requested media will be set after.
341 *
342 * @note The function will open the media, without starting it, allowing the
343 * user to send controls (like seek requests) before Starting the player.
344 *
345 * @warning This function is either synchronous (if the player state is
346 * STOPPED) or asynchronous. In the later case, vlc_player_GetCurrentMedia()
347 * will return the old media, even after this call, and until the
348 * vlc_player_cbs.on_current_media_changed is called.
349 *
350 * @param player locked player instance
351 * @param media new media to play (will be held by the player)
352 * @return VLC_SUCCESS or a VLC error code
353 */
354VLC_API int
356
357/**
358 * Set the next media
359 *
360 * This function replaces the next media to be played.
361 * The user should set the next media from the
362 * vlc_player_cbs.current_media_changed callback or anytime before the current
363 * media is stopped.
364 *
365 * @note The media won't be opened directly by this function. If there is no
366 * current media, the next media will be opened from vlc_player_Start(). If
367 * there is a current playing media, the next media will be opened and played
368 * automatically.
369 *
370 * @param player locked player instance
371 * @param media next media to play (will be held by the player)
372 */
373VLC_API void
375
376/**
377 * Get the current played media.
378 *
379 * @see vlc_player_cbs.on_current_media_changed
380 *
381 * @param player locked player instance
382 * @return a valid media or NULL (if no media is set)
383 */
386
387/**
388 * Get the next played media.
389 *
390 * This function return the media set by vlc_player_SetNextMedia()
391 *
392 * @param player locked player instance
393 * @return a valid media or NULL (if no next media is set)
394 */
397
398/**
399 * Helper that hold the current media
400 */
401static inline input_item_t *
405 return item ? input_item_Hold(item) : NULL;
406}
407
408/**
409 * Start the playback of the current media.
410 *
411 * @param player locked player instance
412 * @return VLC_SUCCESS or a VLC error code
413 */
414VLC_API int
416
417/**
418 * Stop the playback of the current media
419 *
420 * @note This function is asynchronous. In case of success, the user should wait
421 * for the STOPPED state event to know when the stop is finished.
422 *
423 * @param player locked player instance
424 * @return VLC_SUCCESS if the player is being stopped, VLC_EGENERIC otherwise
425 * (no-op)
426 */
427VLC_API int
429
430/**
431 * Pause the playback
432 *
433 * @param player locked player instance
434 */
435VLC_API void
437
438/**
439 * Resume the playback from a pause
440 *
441 * @param player locked player instance
442 */
443VLC_API void
445
446/**
447 * Pause and display the next video frame
448 *
449 * @param player locked player instance
450 */
451VLC_API void
453
454/**
455 * Get the state of the player
456 *
457 * @note Since all players actions are asynchronous, this function won't
458 * reflect the new state immediately. Wait for the
459 * vlc_players_cbs.on_state_changed event to be notified.
460 *
461 * @see vlc_player_state
462 * @see vlc_player_cbs.on_state_changed
463 *
464 * @param player locked player instance
465 * @return the current player state
466 */
469
470/**
471 * Get the error state of the player
472 *
473 * @see vlc_player_cbs.on_capabilities_changed
474 *
475 * @param player locked player instance
476 * @return the current error state
477 */
480
481/**
482 * Helper to get the started state
483 */
484static inline bool
487 switch (vlc_player_GetState(player))
488 {
492 return true;
493 default:
494 return false;
495 }
496}
497
498/**
499 * Helper to get the paused state
500 */
501static inline bool
505}
506
507/**
508 * Helper to toggle the pause state
509 */
510static inline void
513 if (vlc_player_IsStarted(player))
514 {
515 if (vlc_player_IsPaused(player))
516 vlc_player_Resume(player);
517 else
518 vlc_player_Pause(player);
519 }
520}
521
522/**
523 * Get the player capabilities
524 *
525 * @see vlc_player_cbs.on_capabilities_changed
526 *
527 * @param player locked player instance
528 * @return the player capabilities, a bitwise mask of @ref VLC_PLAYER_CAP_SEEK,
529 * @ref VLC_PLAYER_CAP_PAUSE, @ref VLC_PLAYER_CAP_CHANGE_RATE, @ref
530 * VLC_PLAYER_CAP_REWIND
531 */
532VLC_API int
534
535/**
536 * Helper to get the seek capability
537 */
538static inline bool
542}
543
544/**
545 * Helper to get the pause capability
546 */
547static inline bool
551}
552
553/**
554 * Helper to get the change-rate capability
555 */
556static inline bool
562/**
563 * Helper to get the rewindable capability
564 */
565static inline bool
569}
570
571/**
572 * Get the rate of the player
573 *
574 * @see vlc_player_cbs.on_rate_changed
575 *
576 * @param player locked player instance
577 * @return rate of the player (< 1.f is slower, > 1.f is faster)
578 */
579VLC_API float
581
582/**
583 * Change the rate of the player
584 *
585 * @note The rate is saved across several medias
586 *
587 * @param player locked player instance
588 * @param rate new rate (< 1.f is slower, > 1.f is faster)
589 */
590VLC_API void
591vlc_player_ChangeRate(vlc_player_t *player, float rate);
592
593/**
594 * Increment the rate of the player (faster)
595 *
596 * @param player locked player instance
597 */
598VLC_API void
600
601/**
602 * Decrement the rate of the player (Slower)
603 *
604 * @param player locked player instance
605 */
606VLC_API void
608
609/**
610 * Get the length of the current media
611 *
612 * @note A started and playing media doesn't have necessarily a valid length.
613 *
614 * @see vlc_player_cbs.on_length_changed
615 *
616 * @param player locked player instance
617 * @return a valid length or VLC_TICK_INVALID (if no media is set,
618 * playback is not yet started or in case of error)
619 */
622
623/**
624 * Get the time of the current media
625 *
626 * @note A started and playing media doesn't have necessarily a valid time.
627 *
628 * @see vlc_player_cbs.on_position_changed
629 *
630 * @param player locked player instance
631 * @return a valid time or VLC_TICK_INVALID (if no media is set, the media
632 * doesn't have any time, if playback is not yet started or in case of error)
633 */
636
637/**
638 * Get the position of the current media
639 *
640 * @see vlc_player_cbs.on_position_changed
641 *
642 * @param player locked player instance
643 * @return a valid position in the range [0.f;1.f] or -1.f (if no media is
644 * set,if playback is not yet started or in case of error)
645 */
646VLC_API double
648
649/**
650 * Seek the current media by position
651 *
652 * @note This function can be called before vlc_player_Start() in order to set
653 * a starting position.
654 *
655 * @param player locked player instance
656 * @param position position in the range [0.f;1.f]
657 * @param speed precise of fast
658 * @param whence absolute or relative
659 */
660VLC_API void
661vlc_player_SeekByPos(vlc_player_t *player, double position,
662 enum vlc_player_seek_speed speed,
663 enum vlc_player_whence whence);
664
665/**
666 * Seek the current media by time
667 *
668 * @note This function can be called before vlc_player_Start() in order to set
669 * a starting position.
670 *
671 * @warning This function has an effect only if the media has a valid length.
672 *
673 * @param player locked player instance
674 * @param time a time in the range [0;length]
675 * @param speed precise of fast
676 * @param whence absolute or relative
677 */
678VLC_API void
680 enum vlc_player_seek_speed speed,
681 enum vlc_player_whence whence);
682
683/**
684 * Helper to set the absolute position precisely
685 */
686static inline void
687vlc_player_SetPosition(vlc_player_t *player, double position)
693/**
694 * Helper to set the absolute position fast
695 */
696static inline void
697vlc_player_SetPositionFast(vlc_player_t *player, double position)
703/**
704 * Helper to jump the position precisely
705 */
706static inline void
707vlc_player_JumpPos(vlc_player_t *player, double jumppos)
709 /* No fask seek for jumps. Indeed, jumps can seek to the current position
710 * if not precise enough or if the jump value is too small. */
713}
714
715/**
716 * Helper to set the absolute time precisely
717 */
718static inline void
725/**
726 * Helper to set the absolute time fast
727 */
728static inline void
735/**
736 * Helper to jump the time precisely
737 */
738static inline void
741 /* No fask seek for jumps. Indeed, jumps can seek to the current position
742 * if not precise enough or if the jump value is too small. */
745}
746
747/**
748 * Display the player position on the vout OSD
749 *
750 * @param player locked player instance
751 */
752VLC_API void
754
755/**
756 * Enable A to B loop of the current media
757 *
758 * This function need to be called 2 times with VLC_PLAYER_ABLOOP_A and
759 * VLC_PLAYER_ABLOOP_B to setup an A to B loop. It uses and stores the
760 * current time/position when called. The B time must be higher than the
761 * A time.
762 *
763 * @param player locked player instance
764 * @param abloop select which A/B cursor to set
765 * @return VLC_SUCCESS or a VLC error code
766 */
767VLC_API int
769
770/**
771 * Enable A to B loop of the current media by setting start and end time
772 *
773 * The B time must be higher than the A time.
774 *
775 * @param player locked player instance
776 * @param a_time start time for the loop
777 * @param b_time end time for the loop
778 * @return VLC_SUCCESS or a VLC error code
779 */
780VLC_API int
782
783/**
784 * Enable A to B loop of the current media by setting start and end position
785 *
786 * The B position must be higher than the A position.
787 *
788 * @param player locked player instance
789 * @param a_pos start position for the loop
790 * @param b_pos end position for the loop
791 * @return VLC_SUCCESS or a VLC error code
792 */
793VLC_API int
794vlc_player_SetAtoBLoopPosition(vlc_player_t *player, double a_pos, double b_pos);
795
796/**
797 * Reset/remove the A to B loop of the current media
798 *
799 * @param player locked player instance
800 * @return VLC_SUCCESS or a VLC error code
801 */
802VLC_API int
804
805/**
806 * Get the A to B loop status
807 *
808 * @note If the returned status is VLC_PLAYER_ABLOOP_A, then a_time and a_pos
809 * will be valid. If the returned status is VLC_PLAYER_ABLOOP_B, then all
810 * output parameters are valid. If the returned status is
811 * VLC_PLAYER_ABLOOP_NONE, then all output parameters are invalid.
812 *
813 * @see vlc_player_cbs.on_atobloop_changed
814 *
815 * @param player locked player instance
816 * @param a_time A time or VLC_TICK_INVALID (if the media doesn't have valid
817 * times)
818 * @param a_pos A position
819 * @param b_time B time or VLC_TICK_INVALID (if the media doesn't have valid
820 * times)
821 * @param b_pos B position
822 * @return A to B loop status
823 */
825vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, double *a_pos,
826 vlc_tick_t *b_time, double *b_pos);
827
828/**
829 * Navigate (for DVD/Bluray menus or viewpoint)
830 *
831 * @param player locked player instance
832 * @param nav navigation key
833 */
834VLC_API void
836
837/**
838 * Update the viewpoint
839 *
840 * @param player locked player instance
841 * @param viewpoint the viewpoint value
842 * @param whence absolute or relative
843 */
844VLC_API void
846 const vlc_viewpoint_t *viewpoint,
847 enum vlc_player_whence whence);
848
849/**
850 * Check if the playing is recording
851 *
852 * @see vlc_player_cbs.on_recording_changed
853 *
854 * @param player locked player instance
855 * @return true if the player is recording
856 */
857VLC_API bool
859
860/**
861 * Enable or disable recording for the current media
862 *
863 * @note A successful call will trigger the vlc_player_cbs.on_recording_changed
864 * event.
865 *
866 * @param player locked player instance
867 * @param enabled true to enable recording
868 * @param dir_path path of the recording directory or NULL (use default path),
869 * has only an effect when first enabling recording.
870 */
871VLC_API void
872vlc_player_SetRecordingEnabled(vlc_player_t *player, bool enabled,
873 const char *dir_path);
874
875/**
876 * Helper to toggle the recording state
877 */
878static inline void
882}
883
884/**
885 * Add an associated (or external) media to the current media
886 *
887 * @param player locked player instance
888 * @param cat SPU_ES or UNKNOWN_ES
889 * @param uri absolute uri of the external media
890 * @param select true to select the track of this external media
891 * @param notify true to notify the OSD
892 * @param check_ext true to check subtitles extension
893 */
894VLC_API int
896 enum es_format_category_e cat, const char *uri,
897 bool select, bool notify, bool check_ext);
898
899/**
900 * Get the signal quality and strength of the current media
901 *
902 * @param player locked player instance
903 * @param quality a pointer that will be assigned with the signal quality
904 * @param strength a pointer that will be assigned with the signal strength
905 * @retval VLC_SUCCESS when quality and strength have been assigned
906 * @retval VLC_EGENERIC in case of error (strength and quality are not assigned)
907 */
908VLC_API int
909vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength);
910
911/**
912 * Get the statistics of the current media
913 *
914 * @warning The returned pointer becomes invalid when the player is unlocked.
915 * The referenced structure can be safely copied.
916 *
917 * @see vlc_player_cbs.on_statistics_changed
918 *
919 * @param player locked player instance
920 * @return pointer to the player stats structure or NULL
921 */
922VLC_API const struct input_stats_t *
924
925/**
926 * Restore the previous playback position of the current media
927 */
928VLC_API void
930
931/**
932 * Get the V4L2 object used to do controls
933 *
934 * @param player locked player instance
935 * @return the V4L2 object or NULL if not any. This object must be used with
936 * the player lock held.
937 */
940
941/** @} vlc_player__playback */
942
943/**
944 * @defgroup vlc_player__titles Title and chapter control
945 * @{
946 */
947
948/**
949 * Player chapter structure
950 */
953 /** Chapter name, always valid */
954 const char *name;
955 /** Position of this chapter */
958
959/** vlc_player_title.flags: The title is a menu. */
960#define VLC_PLAYER_TITLE_MENU 0x01
961/** vlc_player_title.flags: The title is interactive. */
962#define VLC_PLAYER_TITLE_INTERACTIVE 0x02
963/** vlc_player_title.flags: The title is the main one. */
964#define VLC_PLAYER_TITLE_MAIN 0x04
966/** Player title structure */
967struct vlc_player_title
969 /** Title name, always valid */
970 const char *name;
971 /** Length of the title */
973 /** Bit flag of @ref VLC_PLAYER_TITLE_MENU and @ref
974 * VLC_PLAYER_TITLE_INTERACTIVE */
975 unsigned flags;
976 /** Number of chapters, can be 0 */
977 size_t chapter_count;
978 /** Array of chapters, can be NULL */
979 const struct vlc_player_chapter *chapters;
981
982/**
983 * Opaque structure representing a list of @ref vlc_player_title.
984 *
985 * @see vlc_player_GetTitleList()
986 * @see vlc_player_title_list_GetCount()
987 * @see vlc_player_title_list_GetAt()
988 */
991/**
992 * Hold the title list of the player
993 *
994 * This function can be used to pass this title list from a callback to an
995 * other thread.
996 *
997 * @see vlc_player_cbs.on_titles_changed
998 *
999 * @return the same instance
1000 */
1003
1004/**
1005 * Release of previously held title list
1006 */
1007VLC_API void
1009
1010/**
1011 * Get the number of title of a list
1012 */
1013VLC_API size_t
1015
1016/**
1017 * Get the title at a given index
1018 *
1019 * @param titles a valid title list
1020 * @param idx index in the range [0; count[
1021 * @return a valid title (can't be NULL)
1022 */
1023VLC_API const struct vlc_player_title *
1025
1026/**
1027 * Get the title list of the current media
1028 *
1029 * @see vlc_player_cbs.on_titles_changed
1030 *
1031 * @param player locked player instance
1032 */
1035
1036/**
1037 * Get the selected title index for the current media
1038 *
1039 * @see vlc_player_cbs.on_title_selection_changed
1040 *
1041 * @param player locked player instance
1042 */
1043VLC_API ssize_t
1045
1046/**
1047 * Helper to get the current selected title
1048 */
1049static inline const struct vlc_player_title *
1053 if (!titles)
1054 return NULL;
1055 ssize_t selected_idx = vlc_player_GetSelectedTitleIdx(player);
1056 if (selected_idx < 0)
1057 return NULL;
1058 return vlc_player_title_list_GetAt(titles, selected_idx);
1059}
1060
1061/**
1062 * Select a title index for the current media
1063 *
1064 * @note A successful call will trigger the
1065 * vlc_player_cbs.on_title_selection_changed event.
1066 *
1067 * @see vlc_player_title_list_GetAt()
1068 * @see vlc_player_title_list_GetCount()
1069 *
1070 * @param player locked player instance
1071 * @param index valid index in the range [0;count[
1072 */
1073VLC_API void
1074vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index);
1075
1076/**
1077 * Select a title for the current media
1078 *
1079 * @note A successful call will trigger the
1080 * vlc_player_cbs.on_title_selection_changed event.
1081 *
1082 * @see vlc_player_title_list_GetAt()
1083 * @see vlc_player_title_list_GetCount()
1084 *
1085 * @param player locked player instance
1086 * @param title a valid title coming from the vlc_player_title_list
1087 */
1088VLC_API void
1090 const struct vlc_player_title *title);
1091
1092/**
1093 * Select a chapter for the current media
1094 *
1095 * @note A successful call will trigger the
1096 * vlc_player_cbs.on_chapter_selection_changed event.
1097 *
1098 * @param player locked player instance
1099 * @param title the selected title
1100 * @param chapter_idx index from vlc_player_title.chapters
1101 */
1102VLC_API void
1104 const struct vlc_player_title *title,
1105 size_t chapter_idx);
1106
1107/**
1108 * Select the next title for the current media
1109 *
1110 * @see vlc_player_SelectTitleIdx()
1111 */
1112VLC_API void
1114
1115/**
1116 * Select the previous title for the current media
1117 *
1118 * @see vlc_player_SelectTitleIdx()
1119 */
1120VLC_API void
1122
1123/**
1124 * Get the selected chapter index for the current media
1125 *
1126 * @see vlc_player_cbs.on_chapter_selection_changed
1127 *
1128 * @param player locked player instance
1129 */
1130VLC_API ssize_t
1132
1133/**
1134 * Helper to get the current selected chapter
1135 */
1136static inline const struct vlc_player_chapter *
1139 const struct vlc_player_title *title = vlc_player_GetSelectedTitle(player);
1140 if (!title || !title->chapter_count)
1141 return NULL;
1142 ssize_t chapter_idx = vlc_player_GetSelectedChapterIdx(player);
1143 return chapter_idx >= 0 ? &title->chapters[chapter_idx] : NULL;
1144}
1145
1146/**
1147 * Select a chapter index for the current media
1148 *
1149 * @note A successful call will trigger the
1150 * vlc_player_cbs.on_chapter_selection_changed event.
1151 *
1152 * @see vlc_player_title.chapters
1153 *
1154 * @param player locked player instance
1155 * @param index valid index in the range [0;vlc_player_title.chapter_count[
1156 */
1157VLC_API void
1158vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index);
1159
1160/**
1161 * Select the next chapter for the current media
1162 *
1163 * @see vlc_player_SelectChapterIdx()
1164 */
1165VLC_API void
1167
1168/**
1169 * Select the previous chapter for the current media
1170 *
1171 * @see vlc_player_SelectChapterIdx()
1172 */
1173VLC_API void
1175
1176/** @} vlc_player__titles */
1177
1178/**
1179 * @defgroup vlc_player__programs Program control
1180 * @{
1181 */
1182
1183/**
1184 * Player program structure.
1185 */
1186struct vlc_player_program
1188 /** Id used for vlc_player_SelectProgram() */
1189 int group_id;
1190 /** Program name, always valid */
1191 const char *name;
1192 /** True if the program is selected */
1193 bool selected;
1194 /** True if the program is scrambled */
1195 bool scrambled;
1197
1198/**
1199 * Duplicate a program
1200 *
1201 * This function can be used to pass a program from a callback to an other
1202 * context.
1203 *
1204 * @see vlc_player_cbs.on_program_list_changed
1205 *
1206 * @return a duplicated program or NULL on allocation error
1207 */
1209vlc_player_program_Dup(const struct vlc_player_program *prgm);
1210
1211/**
1212 * Delete a duplicated program
1213 */
1214VLC_API void
1216
1217/**
1218 * Get the number of programs
1219 *
1220 * @warning The returned size becomes invalid when the player is unlocked.
1221 *
1222 * @param player locked player instance
1223 * @return number of programs, or 0 (in case of error, or if the media is not
1224 * started)
1225 */
1226VLC_API size_t
1228
1229/**
1230 * Get the program at a specific index
1231 *
1232 * @warning The behaviour is undefined if the index is not valid.
1233 *
1234 * @warning The returned pointer becomes invalid when the player is unlocked.
1235 * The referenced structure can be safely copied with vlc_player_program_Dup().
1236 *
1237 * @param player locked player instance
1238 * @param index valid index in the range [0; count[
1239 * @return a valid program (can't be NULL if vlc_player_GetProgramCount()
1240 * returned a valid count)
1241 */
1242VLC_API const struct vlc_player_program *
1243vlc_player_GetProgramAt(vlc_player_t *player, size_t index);
1244
1245/**
1246 * Get a program from an ES group identifier
1247 *
1248 * @param player locked player instance
1249 * @param group_id a program ID (retrieved from
1250 * vlc_player_cbs.on_program_list_changed or vlc_player_GetProgramAt())
1251 * @return a valid program or NULL (if the program was terminated by the
1252 * playback thread)
1253 */
1254VLC_API const struct vlc_player_program *
1256
1257/**
1258 * Select a program from an ES group identifier
1259 *
1260 * This function can be used to pre-select a program by its id before starting
1261 * the player. It has only effect for the current media. It can also be used
1262 * when the player is already started.
1263 *
1264 * @note Selecting a non-existing program will cause the player to no select
1265 * any programs. Therefore, all tracks will be disabled.
1266 *
1267 * @param player locked player instance
1268 * @param group_id a program ID (retrieved from
1269 * vlc_player_cbs.on_program_list_changed or vlc_player_GetProgramAt())
1270 */
1271VLC_API void
1273
1274/**
1275 * Select the next program
1276 *
1277 * @param player locked player instance
1278 */
1279VLC_API void
1281
1282/**
1283 * Select the previous program
1284 *
1285 * @param player locked player instance
1286 */
1287VLC_API void
1289
1290/**
1291 * Helper to get the current selected program
1292 */
1293static inline const struct vlc_player_program *
1296 size_t count = vlc_player_GetProgramCount(player);
1297 for (size_t i = 0; i < count; ++i)
1298 {
1299 const struct vlc_player_program *program =
1300 vlc_player_GetProgramAt(player, i);
1301 assert(program);
1302 if (program->selected)
1303 return program;
1304 }
1305 return NULL;
1306}
1307
1308/** @} vlc_player__programs */
1309
1310/**
1311 * @defgroup vlc_player__tracks Tracks control
1312 * @{
1313 */
1314
1315/**
1316 * Player selection policy
1317 *
1318 * @see vlc_player_SelectEsId()
1319 */
1322 /**
1323 * Only one track per category is selected. Selecting a track with this
1324 * policy will disable all other tracks for the same category.
1325 */
1327 /**
1328 * Select multiple tracks for one category.
1329 *
1330 * Only one audio track can be selected at a time.
1331 * Two subtitle tracks can be selected simultaneously.
1332 * Multiple video tracks can be selected simultaneously.
1333 */
1336
1337/**
1338 * Player track structure.
1339 *
1340 * A track is a representation of an ES identifier at a given time. Once the
1341 * player is unlocked, all content except the es_id pointer can be updated.
1342 *
1343 * @see vlc_player_cbs.on_track_list_changed
1344 * @see vlc_player_GetTrack
1345 */
1346struct vlc_player_track
1348 /** Id used for any player actions, like vlc_player_SelectEsId() */
1350 /** Track name, always valid */
1351 const char *name;
1352 /** Es format */
1354 /** True if the track is selected */
1355 bool selected;
1357
1358/**
1359 * Duplicate a track
1360 *
1361 * This function can be used to pass a track from a callback to an other
1362 * context. The es_id will be held by the duplicated track.
1363 *
1364 * @warning The returned track won't be updated if the original one is modified
1365 * by the player.
1366 *
1367 * @see vlc_player_cbs.on_track_list_changed
1368 *
1369 * @return a duplicated track or NULL on allocation error
1370 */
1372vlc_player_track_Dup(const struct vlc_player_track *track);
1373
1374/**
1375 * Delete a duplicated track
1376 */
1377VLC_API void
1379
1380/**
1381 * Get the number of tracks for an ES category
1382 *
1383 * @warning The returned size becomes invalid when the player is unlocked.
1384 *
1385 * @param player locked player instance
1386 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1387 * @return number of tracks, or 0 (in case of error, or if the media is not
1388 * started)
1389 */
1390VLC_API size_t
1392
1393/**
1394 * Get the track at a specific index for an ES category
1395 *
1396 * @warning The behaviour is undefined if the index is not valid.
1397 *
1398 * @warning The returned pointer becomes invalid when the player is unlocked.
1399 * The referenced structure can be safely copied with vlc_player_track_Dup().
1400 *
1401 * @param player locked player instance
1402 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1403 * @param index valid index in the range [0; count[
1404 * @return a valid track (can't be NULL if vlc_player_GetTrackCount() returned
1405 * a valid count)
1406 */
1407VLC_API const struct vlc_player_track *
1409 size_t index);
1410
1411/**
1412 * Helper to get the video track count
1413 */
1414static inline size_t
1417 return vlc_player_GetTrackCount(player, VIDEO_ES);
1418}
1419
1420/**
1421 * Helper to get a video track at a specific index
1422 */
1423static inline const struct vlc_player_track *
1424vlc_player_GetVideoTrackAt(vlc_player_t *player, size_t index)
1426 return vlc_player_GetTrackAt(player, VIDEO_ES, index);
1427}
1428
1429/**
1430 * Helper to get the audio track count
1431 */
1432static inline size_t
1435 return vlc_player_GetTrackCount(player, AUDIO_ES);
1436}
1437
1438/**
1439 * Helper to get an audio track at a specific index
1440 */
1441static inline const struct vlc_player_track *
1442vlc_player_GetAudioTrackAt(vlc_player_t *player, size_t index)
1444 return vlc_player_GetTrackAt(player, AUDIO_ES, index);
1445}
1446
1447/**
1448 * Helper to get the subtitle track count
1449 */
1450static inline size_t
1453 return vlc_player_GetTrackCount(player, SPU_ES);
1454}
1455
1456/**
1457 * Helper to get a subtitle track at a specific index
1458 */
1459static inline const struct vlc_player_track *
1460vlc_player_GetSubtitleTrackAt(vlc_player_t *player, size_t index)
1462 return vlc_player_GetTrackAt(player, SPU_ES, index);
1463}
1464
1465/**
1466 * Get a track from an ES identifier
1467 *
1468 * @warning The returned pointer becomes invalid when the player is unlocked.
1469 * The referenced structure can be safely copied with vlc_player_track_Dup().
1470 *
1471 * @param player locked player instance
1472 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1473 * vlc_player_GetTrackAt())
1474 * @return a valid player track or NULL (if the track was terminated by the
1475 * playback thread)
1476 */
1477VLC_API const struct vlc_player_track *
1479
1480/**
1481 * Get and the video output used by a ES identifier
1482 *
1483 * @warning A same vout can be associated with multiple ES during the lifetime
1484 * of the player. The information returned by this function becomes invalid
1485 * when the player is unlocked. The returned vout doesn't need to be released,
1486 * but must be held with vout_Hold() if it is accessed after the player is
1487 * unlocked.
1488 *
1489 * @param player locked player instance
1490 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1491 * vlc_player_GetTrackAt())
1492 * @param order if not null, the order of the vout
1493 * @return a valid vout or NULL (if the track is disabled, it it's not a video
1494 * or spu track, or if the vout failed to start)
1495 */
1498 enum vlc_vout_order *order);
1499
1500/**
1501 * Get the ES identifier of a video output
1502 *
1503 * @warning A same vout can be associated with multiple ES during the lifetime
1504 * of the player. The information returned by this function becomes invalid
1505 * when the player is unlocked. The returned es_id doesn't need to be released,
1506 * but must be held with vlc_es_id_Hold() if it accessed after the player is
1507 * unlocked.
1508 *
1509 * @param player locked player instance
1510 * @param vout vout (can't be NULL)
1511 * @return a valid ES identifier or NULL (if the vout is stopped)
1512 */
1515
1516/**
1517 * Helper to get the selected track from an ES category
1518 *
1519 * @warning The player can have more than one selected track for a same ES
1520 * category. This function will only return the first selected one. Use
1521 * vlc_player_GetTrackAt() and vlc_player_GetTrackCount() to iterate through
1522 * several selected tracks.
1523 */
1524static inline const struct vlc_player_track *
1527 size_t count = vlc_player_GetTrackCount(player, cat);
1528 for (size_t i = 0; i < count; ++i)
1529 {
1530 const struct vlc_player_track *track =
1531 vlc_player_GetTrackAt(player, cat, i);
1532 assert(track);
1533 if (track->selected)
1534 return track;
1535 }
1536 return NULL;
1537}
1538
1539/**
1540 * Select tracks by their string identifier
1541 *
1542 * This function can be used to pre-select a list of tracks before starting the
1543 * player. It has only effect for the current media. It can also be used when
1544 * the player is already started.
1545
1546 * 'str_ids' can contain more than one track id, delimited with ','. "" or any
1547 * invalid track id will cause the player to unselect all tracks of that
1548 * category. NULL will disable the preference for newer tracks without
1549 * unselecting any current tracks.
1550 *
1551 * Example:
1552 * - (VIDEO_ES, "video/1,video/2") will select these 2 video tracks. If there
1553 * is only one video track with the id "video/0", no tracks will be selected.
1554 * - (SPU_ES, "${slave_url_md5sum}/spu/0) will select one spu added by an input
1555 * slave with the corresponding url.
1556 *
1557 * @note The string identifier of a track can be found via vlc_es_id_GetStrId().
1558 *
1559 * @param player locked player instance
1560 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1561 * @param str_ids list of string identifier or NULL
1562 */
1563VLC_API void
1565 enum es_format_category_e cat,
1566 const char *str_ids);
1567
1568/**
1569 * Select a track from an ES identifier
1570 *
1571 * @note A successful call will trigger the
1572 * vlc_player_cbs.on_track_selection_changed event.
1573 *
1574 * @param player locked player instance
1575 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1576 * vlc_player_GetTrackAt())
1577 * @param policy exclusive or simultaneous
1578 * @return the number of track selected for es_id category
1579 */
1580VLC_API unsigned
1582 enum vlc_player_select_policy policy);
1583
1584
1585/**
1586 * Helper to select a track
1587 */
1588static inline unsigned
1590 const struct vlc_player_track *track,
1591 enum vlc_player_select_policy policy)
1592{
1593 return vlc_player_SelectEsId(player, track->es_id, policy);
1594}
1595
1596/**
1597 * Select multiple tracks from a list of ES identifiers.
1598 *
1599 * Any tracks of the category, not referenced in the list will be unselected.
1600 *
1601 * @warning there is no guarantee all requested tracks will be selected. The
1602 * behaviour is undefined if the list is not null-terminated.
1603 *
1604 * @note A successful call will trigger the
1605 * vlc_player_cbs.on_track_selection_changed event for each track that has
1606 * its selection state changed.
1607 *
1608 * @see VLC_PLAYER_SELECT_SIMULTANEOUS
1609 *
1610 * @param player locked player instance
1611 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1612 * @param es_id_list a null-terminated list of ES identifiers. es_ids not
1613 * corresponding to the category will be ignored.
1614 * (ES IDs can be retrieved from vlc_player_cbs.on_track_list_changed or
1615 * vlc_player_GetTrackAt())
1616 * @return the number of track selected for that category
1617 */
1618VLC_API unsigned
1620 enum es_format_category_e cat,
1621 vlc_es_id_t *const es_id_list[]);
1622
1623
1624/**
1625 * Cycle through the tracks
1626 *
1627 * If the last track is already selected, a call to this function will disable
1628 * this last track. And a second call will select the first track.
1629 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1630 *
1631 * @param player locked player instance
1632 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1633 * @param next the cycle order
1634 */
1635VLC_API void
1637 enum vlc_vout_order vout_order, bool next);
1638
1639/**
1640 * Helper to select the next track
1641 *
1642 * If the last track is already selected, a call to this function will disable
1643 * this last track. And a second call will select the first track.
1644 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1645 *
1646 * @param player locked player instance
1647 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1648 */
1649static inline void
1651 enum vlc_vout_order vout_order)
1652{
1653 vlc_player_CycleTrack(player, cat, vout_order, true);
1654}
1655
1656/**
1657 * Helper to select the Previous track
1658 *
1659 * If the first track is already selected, a call to this function will disable
1660 * this first track. And a second call will select the last track.
1661 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1662 *
1663 * @param player locked player instance
1664 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1665 */
1666static inline void
1668 enum vlc_vout_order vout_order)
1669{
1670 vlc_player_CycleTrack(player, cat, vout_order, false);
1671}
1672
1673/**
1674 * Unselect a track from an ES identifier
1675 *
1676 * @warning Other tracks of the same category won't be touched.
1677 *
1678 * @note A successful call will trigger the
1679 * vlc_player_cbs.on_track_selection_changed event.
1680 *
1681 * @param player locked player instance
1682 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1683 * vlc_player_GetTrackAt())
1684 */
1685VLC_API void
1687
1688/**
1689 * Helper to unselect a track
1690 */
1691static inline void
1693 const struct vlc_player_track *track)
1694{
1695 vlc_player_UnselectEsId(player, track->es_id);
1696}
1697
1698/**
1699 * Helper to unselect all tracks from an ES category
1700 */
1701static inline void
1704{
1705 size_t count = vlc_player_GetTrackCount(player, cat);
1706 for (size_t i = 0; i < count; ++i)
1707 {
1708 const struct vlc_player_track *track =
1709 vlc_player_GetTrackAt(player, cat, i);
1710 assert(track);
1711 if (track->selected)
1712 vlc_player_UnselectTrack(player, track);
1713 }
1714}
1715
1716/**
1717 * Restart a track from an ES identifier
1718 *
1719 * @note A successful call will trigger the
1720 * vlc_player_cbs.on_track_selection_changed event.
1721 *
1722 * @param player locked player instance
1723 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1724 * vlc_player_GetTrackAt())
1725 */
1726VLC_API void
1728
1729/**
1730 * Helper to restart a track
1731 */
1732static inline void
1734 const struct vlc_player_track *track)
1735{
1736 vlc_player_RestartEsId(player, track->es_id);
1737}
1738
1739/**
1740 * Helper to restart all selected tracks from an ES category
1741 */
1742static inline void
1745{
1746 size_t count = vlc_player_GetTrackCount(player, cat);
1747 for (size_t i = 0; i < count; ++i)
1748 {
1749 const struct vlc_player_track *track =
1750 vlc_player_GetTrackAt(player, cat, i);
1751 assert(track);
1752 if (track->selected)
1753 vlc_player_RestartTrack(player, track);
1754 }
1755}
1756
1757/**
1758 * Select the language for an ES category
1759 *
1760 * @warning The language will only be set for all future played media.
1761 *
1762 * @param player locked player instance
1763 * @param cat AUDIO_ES or SPU_ES
1764 * @param lang comma separated, two or three letters country code, 'any' as a
1765 * fallback or NULL to reset the default state
1766 */
1767VLC_API void
1769 enum es_format_category_e cat,
1770 const char *lang);
1771
1772/**
1773 * Get the language of an ES category
1774 *
1775 * @warning This only reflects the change made by
1776 * vlc_player_SelectCategoryLanguage(). The current playing track doesn't
1777 * necessarily correspond to the returned language.
1778 *
1779 * @see vlc_player_SelectCategoryLanguage
1780 *
1781 * @param player locked player instance
1782 * @param cat AUDIO_ES or SPU_ES
1783 * @return valid language or NULL, need to be freed
1784 */
1785VLC_API char *
1787 enum es_format_category_e cat);
1788
1789/**
1790 * Helper to select the audio language
1791 */
1792static inline void
1793vlc_player_SelectAudioLanguage(vlc_player_t *player, const char *lang)
1796}
1797
1798/**
1799 * Helper to select the subtitle language
1800 */
1801static inline void
1802vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
1805}
1806
1807/**
1808 * Enable or disable a track category
1809 *
1810 * If a track category is disabled, the player won't select any tracks of this
1811 * category automatically or via an user action (vlc_player_SelectTrack()).
1812 *
1813 * @param player locked player instance
1814 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1815 * @param enabled true to enable
1816 */
1817VLC_API void
1819 enum es_format_category_e cat, bool enabled);
1820
1821/**
1822 * Check if a track category is enabled
1823 *
1824 * @param player locked player instance
1825 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1826 */
1827VLC_API bool
1829 enum es_format_category_e cat);
1830
1831/**
1832 * Helper to enable or disable video tracks
1833 */
1834static inline void
1835vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
1838}
1839
1840/**
1841 * Helper to check if video tracks are enabled
1842 */
1843static inline bool
1847}
1848
1849/**
1850 * Helper to enable or disable audio tracks
1851 */
1852static inline void
1853vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
1856}
1857
1858/**
1859 * Helper to check if audio tracks are enabled
1860 */
1861static inline bool
1865}
1866
1867/**
1868 * Helper to enable or disable subtitle tracks
1869 */
1870static inline void
1871vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
1874}
1875
1876/**
1877 * Helper to check if subtitle tracks are enabled
1878 */
1879static inline bool
1883}
1884
1885/**
1886 * Helper to toggle subtitles
1887 */
1888static inline void
1891 bool enabled = !vlc_player_IsSubtitleEnabled(player);
1892 vlc_player_SetSubtitleEnabled(player, enabled);
1893}
1894
1895/**
1896 * Set the subtitle text scaling factor
1897 *
1898 * @note This function have an effect only if the subtitle track is a text type.
1899 *
1900 * @param player locked player instance
1901 * @param scale factor in the range [10;500] (default: 100)
1902 */
1903VLC_API void
1904vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale);
1905
1906/**
1907 * Get the subtitle text scaling factor
1908 *
1909 * @param player locked player instance
1910 * @return scale factor
1911 */
1912VLC_API unsigned
1914
1915/** @} vlc_player__tracks */
1916
1917/**
1918 * @defgroup vlc_player__tracks_sync Tracks synchronisation (delay)
1919 * @{
1920 */
1921
1922/**
1923 * Get the delay of an ES category for the current media
1924 *
1925 * @see vlc_player_cbs.on_category_delay_changed
1926 *
1927 * @param player locked player instance
1928 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1929 * @return a valid delay or 0
1930 */
1933
1934/**
1935 * Set the delay of one category for the current media
1936 *
1937 * @note A successful call will trigger the
1938 * vlc_player_cbs.on_category_delay_changed event.
1939 *
1940 * @warning This has no effect on tracks where the delay was set by
1941 * vlc_player_SetEsIdDelay()
1942 *
1943 * @param player locked player instance
1944 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1945 * @param delay a valid time
1946 * @param whence absolute or relative
1947 * @return VLC_SUCCESS or VLC_EGENERIC if the category is not handled
1948 */
1949VLC_API int
1951 vlc_tick_t delay, enum vlc_player_whence whence);
1952
1953/**
1954 * Get the delay of a track
1955 *
1956 * @see vlc_player_cbs.on_track_delay_changed
1957 *
1958 * @param player locked player instance
1959 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1960 * vlc_player_GetTrackAt())
1961 * @return a valid delay or INT64_MAX is no delay is set for this track
1962 */
1965
1966/**
1967 * Set the delay of one track
1968 *
1969 * @note A successful call will trigger the
1970 * vlc_player_cbs.on_track_delay_changed event.
1971 *
1972 * @warning Setting the delay of one specific track will override previous and
1973 * future changes of delay made by vlc_player_SetCategoryDelay()
1974 *
1975 * @param player locked player instance
1976 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1977 * vlc_player_GetTrackAt())
1978 * @param delay a valid time or INT64_MAX to use default category delay
1979 * @param whence absolute or relative
1980 * @return VLC_SUCCESS or VLC_EGENERIC if the category of the es_id is not
1981 * handled (VIDEO_ES not supported yet)
1982 */
1983VLC_API int
1985 vlc_tick_t delay, enum vlc_player_whence whence);
1986
1987/**
1988 * Helper to get the audio delay
1989 */
1990static inline vlc_tick_t
1993 return vlc_player_GetCategoryDelay(player, AUDIO_ES);
1994}
1995
1996/**
1997 * Helper to set the audio delay
1998 */
1999static inline void
2002
2003{
2004 vlc_player_SetCategoryDelay(player, AUDIO_ES, delay, whence);
2005}
2006
2007/**
2008 * Helper to get the audio delay
2009 */
2010static inline vlc_tick_t
2013 return vlc_player_GetCategoryDelay(player, VIDEO_ES);
2014}
2015
2016/**
2017 * Helper to set the audio delay
2018 */
2019static inline void
2022
2023{
2024 vlc_player_SetCategoryDelay(player, VIDEO_ES, delay, whence);
2025}
2026
2027/**
2028 * Helper to get the subtitle delay
2029 */
2030static inline vlc_tick_t
2033 return vlc_player_GetCategoryDelay(player, SPU_ES);
2034}
2035
2036/**
2037 * Helper to set the subtitle delay
2038 */
2039static inline void
2042{
2043 vlc_player_SetCategoryDelay(player, SPU_ES, delay, whence);
2044}
2045
2046/**
2047 * Set the associated subtitle FPS
2048 *
2049 * In order to correct the rate of the associated media according to this FPS
2050 * and the media video FPS.
2051 *
2052 * @note A successful call will trigger the
2053 * vlc_player_cbs.on_associated_subs_fps_changed event.
2054 *
2055 * @warning this function will change the rate of all external subtitle files
2056 * associated with the current media.
2057 *
2058 * @param player locked player instance
2059 * @param fps FPS of the subtitle file
2060 */
2061VLC_API void
2063
2064/**
2065 * Get the associated subtitle FPS
2066 *
2067 * @param player locked player instance
2068 * @return fps
2069 */
2070VLC_API float
2072
2073/** @} vlc_player__tracks_sync */
2074
2075/**
2076 * @defgroup vlc_player__teletext Teletext control
2077 * @{
2078 */
2079
2080/**
2081 * Check if the media has a teletext menu
2082 *
2083 * @see vlc_player_cbs.on_teletext_menu_changed
2084 *
2085 * @param player locked player instance
2086 * @return true if the media has a teletext menu
2087 */
2088VLC_API bool
2090
2091/**
2092 * Enable or disable teletext
2093 *
2094 * This function has an effect only if the player has a teletext menu.
2095 *
2096 * @note A successful call will trigger the
2097 * vlc_player_cbs.on_teletext_enabled_changed event.
2098 *
2099 * @param player locked player instance
2100 * @param enabled true to enable
2101 */
2102VLC_API void
2103vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled);
2104
2105/**
2106 * Check if teletext is enabled
2107 *
2108 * @see vlc_player_cbs.on_teletext_enabled_changed
2109 *
2110 * @param player locked player instance
2111 */
2112VLC_API bool
2114
2115/**
2116 * Select a teletext page or do an action from a key
2117 *
2118 * This function has an effect only if the player has a teletext menu.
2119 *
2120 * @note Page keys can be the following: @ref VLC_PLAYER_TELETEXT_KEY_RED,
2121 * @ref VLC_PLAYER_TELETEXT_KEY_GREEN, @ref VLC_PLAYER_TELETEXT_KEY_YELLOW,
2122 * @ref VLC_PLAYER_TELETEXT_KEY_BLUE or @ref VLC_PLAYER_TELETEXT_KEY_INDEX.
2123
2124 * @note A successful call will trigger the
2125 * vlc_player_cbs.on_teletext_page_changed event.
2126 *
2127 * @param player locked player instance
2128 * @param page a page in the range ]0;888] or a valid key
2129 */
2130VLC_API void
2131vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page);
2132
2133/**
2134 * Get the current teletext page
2135 *
2136 * @see vlc_player_cbs.on_teletext_page_changed
2137 *
2138 * @param player locked player instance
2139 */
2140VLC_API unsigned
2142
2143/**
2144 * Enable or disable teletext transparency
2145 *
2146 * This function has an effect only if the player has a teletext menu.
2147
2148 * @note A successful call will trigger the
2149 * vlc_player_cbs.on_teletext_transparency_changed event.
2150 *
2151 * @param player locked player instance
2152 * @param enabled true to enable
2153 */
2154VLC_API void
2156
2157/**
2158 * Check if teletext is transparent
2159 *
2160 * @param player locked player instance
2161 */
2162VLC_API bool
2164
2165/** @} vlc_player__teletext */
2166
2167/**
2168 * @defgroup vlc_player__renderer External renderer control
2169 * @{
2170 */
2171
2172/**
2173 * Set the renderer
2174 *
2175 * Valid for the current media and all future ones.
2176 *
2177 * @note A successful call will trigger the vlc_player_cbs.on_renderer_changed
2178 * event.
2179 *
2180 * @param player locked player instance
2181 * @param renderer a valid renderer item or NULL (to disable it), the item will
2182 * be held by the player
2183 */
2184VLC_API void
2186
2187/**
2188 * Get the renderer
2189 *
2190 * @see vlc_player_cbs.on_renderer_changed
2191 *
2192 * @param player locked player instance
2193 * @return the renderer item set by vlc_player_SetRenderer()
2194 */
2197
2198/** @} vlc_player__renderer */
2199
2200/**
2201 * @defgroup vlc_player__metadata Metadata callbacks
2202 * @{
2203 */
2204
2205/**
2206 * Player metadata listener opaque structure.
2207 *
2208 * This opaque structure is returned by vlc_player_AddMetadataListener() and
2209 * can be used to remove the listener via
2210 * vlc_player_RemoveMetadataListener().
2211 */
2214/**
2215 * Player metadata option
2216 */
2219 /**
2220 * Ask for momentary loudness measurement
2221 *
2222 * Very low CPU usage.
2223 * @see vlc_player_metadata_cbs.on_momentary_loudness_changed
2224 */
2227 /**
2228 * Ask for all loudness measurements
2229 *
2230 * High CPU usage.
2231 * @see vlc_player_metadata_cbs.on_loudness_changed
2232 */
2235
2236/**
2237 * Player metadata callbacks
2238 *
2239 * Can be registered with vlc_player_AddMetadataListener().
2240 *
2241 * @warning To avoid deadlocks, users should never call vlc_player_t functions
2242 * from these callbacks.
2243 */
2246 /**
2247 * Called when the momentary loudness measurement have changed
2248 *
2249 * @see VLC_PLAYER_METADATA_LOUDNESS_MOMEMTARY
2250 *
2251 * Only sent when audio is playing, approximately every 400ms (but can be
2252 * higher, depending on the input sample size).
2253 *
2254 * @param date Absolute date of the measurement. It is most likely in the
2255 * future (0 to 2seconds) depending on the audio output buffer size.
2256 * @param momentary_loudness Momentary loudness
2257 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2258 */
2260 double momentary_loudness,
2261 void *data);
2262
2263 /**
2264 * Called when loudness measurements have changed
2265 *
2266 * @see VLC_PLAYER_METADATA_LOUDNESS_FULL
2267 *
2268 * Only sent when audio is playing, approximately every 400ms (but can be
2269 * higher, depending on the input sample size).
2270 *
2271 * @param date Absolute date of the measurement. It is most likely in the
2272 * future (0 to 2seconds) depending on the audio output buffer size.
2273 * @param loudness loudness measurement
2274 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2275 */
2276 void (*on_loudness_changed)(vlc_tick_t date,
2277 const struct vlc_audio_loudness *loudness,
2278 void *data);
2279};
2280
2281/**
2282 * Add a metadata listener
2283 *
2284 * @note Every registered loudness meter need to be removed by the caller with
2285 * vlc_player_RemoveMetadataListener().
2286 *
2287 * @param player locked player instance
2288 * @param option select which metadata to listen
2289 * @param cbs pointer to a vlc_player_metadata_cbs union, the
2290 * structure must be valid during the lifetime of the player
2291 * @param cbs_data opaque pointer used by the callbacks
2292 * @return a valid listener id, or NULL in case of error (plugin missing)
2293 */
2296 enum vlc_player_metadata_option option,
2297 const union vlc_player_metadata_cbs *cbs,
2298 void *cbs_data);
2299
2300/**
2301 * Remove a metadata listener
2302 *
2303 * @param player player instance
2304 * @param listener_id listener id returned by vlc_player_AddMetadataListener()
2305 */
2306VLC_API void
2308 vlc_player_metadata_listener_id *listener_id);
2309
2310
2311/** @} vlc_player__metadata */
2312
2313/**
2314 * @defgroup vlc_player__aout Audio output control
2315 * @{
2316 */
2317
2318/**
2319 * Player aout listener opaque structure.
2320 *
2321 * This opaque structure is returned by vlc_player_aout_AddListener() and can
2322 * be used to remove the listener via vlc_player_aout_RemoveListener().
2323 */
2326/**
2327 * Player aout callbacks
2328 *
2329 * Can be registered with vlc_player_aout_AddListener().
2330 *
2331 * @warning To avoid deadlocks, users should never call audio_output_t and
2332 * vlc_player_t functions from these callbacks.
2333 */
2336 /**
2337 * Called when the volume has changed
2338 *
2339 * @see vlc_player_aout_SetVolume()
2340 *
2341 * @param aout the main aout of the player
2342 * @param new_volume volume in the range [0;2.f]
2343 * @param data opaque pointer set by vlc_player_aout_AddListener()
2344 */
2345 void (*on_volume_changed)(audio_output_t *aout, float new_volume,
2346 void *data);
2347
2348 /**
2349 * Called when the mute state has changed
2350 *
2351 * @see vlc_player_aout_Mute()
2352 *
2353 * @param aout the main aout of the player
2354 * @param new_mute true if muted
2355 * @param data opaque pointer set by vlc_player_aout_AddListener()
2356 */
2357 void (*on_mute_changed)(audio_output_t *aout, bool new_muted,
2358 void *data);
2359
2360 /**
2361 * Called when the audio device has changed
2362 *
2363 * @param aout the main aout of the player
2364 * @param device the device name
2365 * @param data opaque pointer set by vlc_player_aout_AddListener()
2366 */
2367 void (*on_device_changed)(audio_output_t *aout, const char *device,
2368 void *data);
2369};
2370
2371/**
2372 * Get the audio output
2373 *
2374 * @warning The returned pointer must be released with aout_Release().
2375 *
2376 * @param player player instance
2377 * @return a valid audio_output_t * or NULL (if there is no aouts)
2378 */
2381
2382/**
2383 * Reset the main audio output
2384 *
2385 * @warning The main aout can only by reset if it is not currently used by any
2386 * decoders (before any play).
2387 *
2388 * @param player player instance
2389 */
2390VLC_API void
2392
2393/**
2394 * Add a listener callback for audio output events
2395 *
2396 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2397 * functions.
2398 * @note Every registered callbacks need to be removed by the caller with
2399 * vlc_player_aout_RemoveListener().
2400 *
2401 * @param player player instance
2402 * @param cbs pointer to a vlc_player_aout_cbs structure, the structure must be
2403 * valid during the lifetime of the player
2404 * @param cbs_data opaque pointer used by the callbacks
2405 * @return a valid listener id, or NULL in case of allocation error
2406 */
2409 const struct vlc_player_aout_cbs *cbs,
2410 void *cbs_data);
2411
2412/**
2413 * Remove a aout listener callback
2414 *
2415 * @param player player instance
2416 * @param listener_id listener id returned by vlc_player_aout_AddListener()
2417 */
2418VLC_API void
2420 vlc_player_aout_listener_id *listener_id);
2421
2422/**
2423 * Get the audio volume
2424 *
2425 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2426 * functions.
2427 *
2428 * @see vlc_player_aout_cbs.on_volume_changed
2429 *
2430 * @param player player instance
2431 * @return volume in the range [0;2.f] or -1.f if there is no audio outputs
2432 * (independent of mute)
2433 */
2434VLC_API float
2436
2437/**
2438 * Set the audio volume
2439 *
2440 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2441 * functions.
2442 *
2443 * @note A successful call will trigger the
2444 * vlc_player_vout_cbs.on_volume_changed event.
2445 *
2446 * @param player player instance
2447 * @param volume volume in the range [0;2.f]
2448 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2449 */
2450VLC_API int
2451vlc_player_aout_SetVolume(vlc_player_t *player, float volume);
2452
2453/**
2454 * Increment the audio volume
2455 *
2456 * @see vlc_player_aout_SetVolume()
2457 *
2458 * @param player player instance
2459 * @param steps number of "volume-step"
2460 * @param result pointer to store the resulting volume (can be NULL)
2461 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2462 */
2463VLC_API int
2464vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result);
2465
2466/**
2467 * Helper to decrement the audio volume
2468 */
2469static inline int
2470vlc_player_aout_DecrementVolume(vlc_player_t *player, int steps, float *result)
2472 return vlc_player_aout_IncrementVolume(player, -steps, result);
2473}
2474
2475/**
2476 * Check if the audio output is muted
2477 *
2478 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2479 * functions.
2480 *
2481 * @see vlc_player_aout_cbs.on_mute_changed
2482 *
2483 * @param player player instance
2484 * @return 0 if not muted, 1 if muted, -1 if there is no audio outputs
2485 */
2486VLC_API int
2488
2489/**
2490 * Mute or unmute the audio output
2491 *
2492 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2493 * functions.
2494 *
2495 * @note A successful call will trigger the
2496 * vlc_player_aout_cbs.on_mute_changed event.
2497 *
2498 * @param player player instance
2499 * @param mute true to mute
2500 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2501 */
2502VLC_API int
2503vlc_player_aout_Mute(vlc_player_t *player, bool mute);
2504
2505/**
2506 * Helper to toggle the mute state
2507 */
2508static inline int
2511 return vlc_player_aout_Mute(player,
2512 !vlc_player_aout_IsMuted(player));
2513}
2514
2515/**
2516 * Enable or disable an audio filter
2517 *
2518 * @see aout_EnableFilter()
2519 *
2520 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2521 */
2522VLC_API int
2523vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add);
2524
2525/** @} vlc_player__aout */
2526
2527/**
2528 * @defgroup vlc_player__vout Video output control
2529 * @{
2530 */
2531
2532/**
2533 * Player vout listener opaque structure.
2534 *
2535 * This opaque structure is returned by vlc_player_vout_AddListener() and can
2536 * be used to remove the listener via vlc_player_vout_RemoveListener().
2537 */
2540/**
2541 * action of vlc_player_cbs.on_vout_changed callback
2542 */
2549/**
2550 * Player vout callbacks
2551 *
2552 * Can be registered with vlc_player_vout_AddListener().
2553 *
2554 * @note The state changed from the callbacks can be either applied on the
2555 * player (and all future video outputs), or on a specified video output. The
2556 * state is applied on the player when the vout argument is NULL.
2557 *
2558 * @warning To avoid deadlocks, users should never call vout_thread_t and
2559 * vlc_player_t functions from these callbacks.
2560 */
2563 /**
2564 * Called when the player and/or vout fullscreen state has changed
2565 *
2566 * @see vlc_player_vout_SetFullscreen()
2567 *
2568 * @param vout cf. vlc_player_vout_cbs note
2569 * @param enabled true when fullscreen is enabled
2570 * @param data opaque pointer set by vlc_player_vout_AddListener()
2571 */
2572 void (*on_fullscreen_changed)(vout_thread_t *vout, bool enabled,
2573 void *data);
2574
2575 /**
2576 * Called when the player and/or vout wallpaper mode has changed
2577 *
2578 * @see vlc_player_vout_SetWallpaperModeEnabled()
2579 *
2580 * @param vout cf. vlc_player_vout_cbs note
2581 * @param enabled true when wallpaper mode is enabled
2582 * @param data opaque pointer set by vlc_player_vout_AddListener()
2583 */
2584 void (*on_wallpaper_mode_changed)(vout_thread_t *vout, bool enabled,
2585 void *data);
2586};
2587
2588
2589/**
2590 * Get and hold the main video output
2591 *
2592 * @warning the returned vout_thread_t * must be released with vout_Release().
2593 * @see vlc_players_cbs.on_vout_changed
2594 *
2595 * @note The player is guaranteed to always hold one valid vout. Only vout
2596 * variables can be changed from this instance. The vout returned before
2597 * playback is not necessarily the same one that will be used for playback.
2598 *
2599 * @param player player instance
2600 * @return a valid vout_thread_t * or NULL, cf. warning
2601 */
2604
2605/**
2606 * Get and hold the list of video output
2607 *
2608 * @warning All vout_thread_t * element of the array must be released with
2609 * vout_Release(). The returned array must be freed.
2610 *
2611 * @see vlc_players_cbs.on_vout_changed
2612 *
2613 * @param player player instance
2614 * @param count valid pointer to store the array count
2615 * @return a array of vout_thread_t * or NULL, cf. warning
2616 */
2619
2620/**
2621 * Add a listener callback for video output events
2622 *
2623 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2624 * functions.
2625 * @note Every registered callbacks need to be removed by the caller with
2626 * vlc_player_vout_RemoveListener().
2627 *
2628 * @param player player instance
2629 * @param cbs pointer to a vlc_player_vout_cbs structure, the structure must be
2630 * valid during the lifetime of the player
2631 * @param cbs_data opaque pointer used by the callbacks
2632 * @return a valid listener id, or NULL in case of allocation error
2633 */
2636 const struct vlc_player_vout_cbs *cbs,
2637 void *cbs_data);
2638
2639/**
2640 * Remove a vout listener callback
2641 *
2642 * @param player player instance
2643 * @param listener_id listener id returned by vlc_player_vout_AddListener()
2644 */
2645VLC_API void
2647 vlc_player_vout_listener_id *listener_id);
2648
2649/**
2650 * Check if the player is fullscreen
2651 *
2652 * @warning The fullscreen state of the player and all vouts can be different.
2653 *
2654 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2655 * functions.
2656 *
2657 * @see vlc_player_vout_cbs.on_fullscreen_changed
2658 *
2659 * @param player player instance
2660 * @return true if the player is fullscreen
2661 */
2662VLC_API bool
2664
2665/**
2666 * Enable or disable the player fullscreen state
2667 *
2668 * This will have an effect on all current and future vouts.
2669 *
2670 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2671 * functions.
2672 * @note A successful call will trigger the
2673 * vlc_player_vout_cbs.on_fullscreen_changed event.
2674 *
2675 * @param player player instance
2676 * @param enabled true to enable fullscreen
2677 */
2678VLC_API void
2679vlc_player_vout_SetFullscreen(vlc_player_t *player, bool enabled);
2680
2681/**
2682 * Helper to toggle the player fullscreen state
2683 */
2684static inline void
2689}
2690
2691/**
2692 * Check if the player has wallpaper-mode enaled
2693 *
2694 * @warning The wallpaper-mode state of the player and all vouts can be
2695 * different.
2696 *
2697 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2698 * functions.
2699 *
2700 * @see vlc_player_vout_cbs.on_wallpaper_mode_changed
2701 *
2702 * @param player player instance
2703 * @return true if the player is fullscreen
2704 */
2705VLC_API bool
2707
2708/**
2709 * Enable or disable the player wallpaper-mode
2710 *
2711 * This will have an effect on all current and future vouts.
2712 *
2713 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2714 * functions.
2715 * @note A successful call will trigger the
2716 * vlc_player_vout_cbs.on_wallpaper_mode_changed event.
2717 *
2718 * @param player player instance
2719 * @param enabled true to enable wallpaper-mode
2720 */
2721VLC_API void
2723
2724/**
2725 * Helper to toggle the player wallpaper-mode state
2726 */
2727static inline void
2734/**
2735 * Take a snapshot on all vouts
2736 *
2737 * @param player player instance
2738 */
2739VLC_API void
2741
2742/**
2743 * Display an OSD message on all vouts
2744 *
2745 * @param player player instance
2746 * @param fmt format string
2747 */
2748VLC_API void
2749vlc_player_osd_Message(vlc_player_t *player, const char *fmt, ...);
2750
2751/** @} vlc_player__vout */
2752
2753/**
2754 * @defgroup vlc_player__events Player events
2755 * @{
2756 */
2757
2758/**
2759 * Player listener opaque structure.
2760 *
2761 * This opaque structure is returned by vlc_player_AddListener() and can be
2762 * used to remove the listener via vlc_player_RemoveListener().
2763 */
2766/**
2767 * Action of vlc_player_cbs.on_track_list_changed,
2768 * vlc_player_cbs.on_program_list_changed callbacks
2769 */
2777/**
2778 * Player callbacks
2779 *
2780 * Can be registered with vlc_player_AddListener().
2781 *
2782 * All callbacks are called with the player locked (cf. vlc_player_Lock()) and
2783 * from any threads (and even synchronously from a vlc_player function in some
2784 * cases). It is safe to call any vlc_player functions from these callbacks
2785 * except vlc_player_Delete().
2786 *
2787 * @warning To avoid deadlocks, users should never call vlc_player functions
2788 * with an external mutex locked and lock this same mutex from a player
2789 * callback.
2790 */
2791struct vlc_player_cbs
2793 /**
2794 * Called when the current media has changed
2795 *
2796 * @note This can be called from the PLAYING state (when the player plays
2797 * the next media internally) or from the STOPPED state (from
2798 * vlc_player_SetCurrentMedia() or from an internal transition).
2799 *
2800 * The user could set the next media via vlc_player_SetNextMedia() from
2801 * the current callback or anytime before the current media is stopped.
2802
2803 * @see vlc_player_SetCurrentMedia()
2804 *
2805 * @param player locked player instance
2806 * @param new_media new media currently played or NULL (when there is no
2807 * more media to play)
2808 * @param data opaque pointer set by vlc_player_AddListener()
2809 */
2810 void (*on_current_media_changed)(vlc_player_t *player,
2811 input_item_t *new_media, void *data);
2812
2813 /**
2814 * Called when the player state has changed
2815 *
2816 * @see vlc_player_state
2817 *
2818 * @param player locked player instance
2819 * @param new_state new player state
2820 * @param data opaque pointer set by vlc_player_AddListener()
2821 */
2822 void (*on_state_changed)(vlc_player_t *player,
2823 enum vlc_player_state new_state, void *data);
2824
2825 /**
2826 * Called when a media triggered an error
2827 *
2828 * Can be called from any states. When it happens the player will stop
2829 * itself. It is safe to play an other media or event restart the player
2830 * (This will reset the error state).
2831 *
2832 * @param player locked player instance
2833 * @param error player error
2834 * @param data opaque pointer set by vlc_player_AddListener()
2835 */
2836 void (*on_error_changed)(vlc_player_t *player,
2837 enum vlc_player_error error, void *data);
2838
2839 /**
2840 * Called when the player buffering (or cache) has changed
2841 *
2842 * This event is always called with the 0 and 1 values before a playback
2843 * (in case of success). Values in between depends on the media type.
2844 *
2845 * @param player locked player instance
2846 * @param new_buffering buffering in the range [0:1]
2847 * @param data opaque pointer set by vlc_player_AddListener()
2848 */
2849 void (*on_buffering_changed)(vlc_player_t *player,
2850 float new_buffering, void *data);
2851
2852 /**
2853 * Called when the player rate has changed
2854 *
2855 * Triggered by vlc_player_ChangeRate(), not sent when the media starts
2856 * with the default rate (1.f)
2857 *
2858 * @param player locked player instance
2859 * @param new_rate player
2860 * @param data opaque pointer set by vlc_player_AddListener()
2861 */
2862 void (*on_rate_changed)(vlc_player_t *player,
2863 float new_rate, void *data);
2864
2865 /**
2866 * Called when the media capabilities has changed
2867 *
2868 * Always called when the media is opening or stopping.
2869 * Can be called during playback.
2870 *
2871 * @param player locked player instance
2872 * @param old_caps old player capabilities
2873 * @param new_caps new player capabilities
2874 * @param data opaque pointer set by vlc_player_AddListener()
2875 */
2876 void (*on_capabilities_changed)(vlc_player_t *player,
2877 int old_caps, int new_caps, void *data);
2878
2879 /**
2880 * Called when the player position has changed
2881 *
2882 * @note A started and playing media doesn't have necessarily a valid time.
2883 *
2884 * @param player locked player instance
2885 * @param new_time a valid time or VLC_TICK_INVALID
2886 * @param new_pos a valid position
2887 * @param data opaque pointer set by vlc_player_AddListener()
2888 */
2889 void (*on_position_changed)(vlc_player_t *player,
2890 vlc_tick_t new_time, double new_pos, void *data);
2891
2892 /**
2893 * Called when the media length has changed
2894 *
2895 * May be called when the media is opening or during playback.
2896 *
2897 * @note A started and playing media doesn't have necessarily a valid length.
2898 *
2899 * @param player locked player instance
2900 * @param new_length a valid time or VLC_TICK_INVALID
2901 * @param data opaque pointer set by vlc_player_AddListener()
2902 */
2903 void (*on_length_changed)(vlc_player_t *player,
2904 vlc_tick_t new_length, void *data);
2905
2906 /**
2907 * Called when a track is added, removed, or updated
2908 *
2909 * @note The track is only valid from this callback context. Users should
2910 * duplicate this track via vlc_player_track_Dup() if they want to use it
2911 * from an other context.
2912 *
2913 * @param player locked player instance
2914 * @param action added, removed or updated
2915 * @param track valid track
2916 * @param data opaque pointer set by vlc_player_AddListener()
2917 */
2918 void (*on_track_list_changed)(vlc_player_t *player,
2920 const struct vlc_player_track *track, void *data);
2921
2922 /**
2923 * Called when a new track is selected and/or unselected
2924 *
2925 * @note This event can be called with both unselected_id and selected_id
2926 * valid. This mean that a new track is replacing the old one.
2927 *
2928 * @param player locked player instance
2929 * @param unselected_id valid track id or NULL (when nothing is unselected)
2930 * @param selected_id valid track id or NULL (when nothing is selected)
2931 * @param data opaque pointer set by vlc_player_AddListener()
2932 */
2934 vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data);
2935
2936 /**
2937 * Called when a track delay has changed
2938 *
2939 * @param player locked player instance
2940 * @param es_id valid track id
2941 * @param delay a valid delay or INT64_MAX if the delay of this track is
2942 * canceled
2943 */
2944 void (*on_track_delay_changed)(vlc_player_t *player,
2945 vlc_es_id_t *es_id, vlc_tick_t delay, void *data);
2946
2947 /**
2948 * Called when a new program is added, removed or updated
2949 *
2950 * @note The program is only valid from this callback context. Users should
2951 * duplicate this program via vlc_player_program_Dup() if they want to use
2952 * it from an other context.
2953 *
2954 * @param player locked player instance
2955 * @param action added, removed or updated
2956 * @param prgm valid program
2957 * @param data opaque pointer set by vlc_player_AddListener()
2958 */
2959 void (*on_program_list_changed)(vlc_player_t *player,
2961 const struct vlc_player_program *prgm, void *data);
2962
2963 /**
2964 * Called when a new program is selected and/or unselected
2965 *
2966 * @note This event can be called with both unselected_id and selected_id
2967 * valid. This mean that a new program is replacing the old one.
2968 *
2969 * @param player locked player instance
2970 * @param unselected_id valid program id or -1 (when nothing is unselected)
2971 * @param selected_id valid program id or -1 (when nothing is selected)
2972 * @param data opaque pointer set by vlc_player_AddListener()
2973 */
2975 int unselected_id, int selected_id, void *data);
2976
2977 /**
2978 * Called when the media titles has changed
2979 *
2980 * This event is not called when the opening media doesn't have any titles.
2981 * This title list and all its elements are constant. If an element is to
2982 * be updated, a new list will be sent from this callback.
2983 *
2984 * @note Users should hold this list with vlc_player_title_list_Hold() if
2985 * they want to use it from an other context.
2986 *
2987 * @param player locked player instance
2988 * @param titles valid title list or NULL
2989 * @param data opaque pointer set by vlc_player_AddListener()
2990 */
2991 void (*on_titles_changed)(vlc_player_t *player,
2992 vlc_player_title_list *titles, void *data);
2993
2994 /**
2995 * Called when a new title is selected
2996 *
2997 * There are no events when a title is unselected. Titles are automatically
2998 * unselected when the title list changes. Titles and indexes are always
2999 * valid inside the vlc_player_title_list sent by
3000 * vlc_player_cbs.on_titles_changed.
3001 *
3002 * @param player locked player instance
3003 * @param new_title new selected title
3004 * @param new_idx index of this title
3005 * @param data opaque pointer set by vlc_player_AddListener()
3006 */
3008 const struct vlc_player_title *new_title, size_t new_idx, void *data);
3009
3010 /**
3011 * Called when a new chapter is selected
3012 *
3013 * There are no events when a chapter is unselected. Chapters are
3014 * automatically unselected when the title list changes. Titles, chapters
3015 * and indexes are always valid inside the vlc_player_title_list sent by
3016 * vlc_player_cbs.on_titles_changed.
3017 *
3018 * @param player locked player instance
3019 * @param title selected title
3020 * @param title_idx selected title index
3021 * @param chapter new selected chapter
3022 * @param chapter_idx new selected chapter index
3023 * @param data opaque pointer set by vlc_player_AddListener()
3024 */
3026 const struct vlc_player_title *title, size_t title_idx,
3027 const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx,
3028 void *data);
3029
3030 /**
3031 * Called when the media has a teletext menu
3032 *
3033 * @param player locked player instance
3034 * @param has_teletext_menu true if the media has a teletext menu
3035 * @param data opaque pointer set by vlc_player_AddListener()
3036 */
3037 void (*on_teletext_menu_changed)(vlc_player_t *player,
3038 bool has_teletext_menu, void *data);
3039
3040 /**
3041 * Called when teletext is enabled or disabled
3042 *
3043 * @see vlc_player_SetTeletextEnabled()
3044 *
3045 * @param player locked player instance
3046 * @param enabled true if teletext is enabled
3047 * @param data opaque pointer set by vlc_player_AddListener()
3048 */
3050 bool enabled, void *data);
3051
3052 /**
3053 * Called when the teletext page has changed
3054 *
3055 * @see vlc_player_SelectTeletextPage()
3056 *
3057 * @param player locked player instance
3058 * @param new_page page in the range ]0;888]
3059 * @param data opaque pointer set by vlc_player_AddListener()
3060 */
3061 void (*on_teletext_page_changed)(vlc_player_t *player,
3062 unsigned new_page, void *data);
3063
3064 /**
3065 * Called when the teletext transparency has changed
3066 *
3067 * @see vlc_player_SetTeletextTransparency()
3068 *
3069 * @param player locked player instance
3070 * @param enabled true is the teletext overlay is transparent
3071 * @param data opaque pointer set by vlc_player_AddListener()
3072 */
3074 bool enabled, void *data);
3075
3076 /**
3077 * Called when the player category delay has changed for the current media
3078 *
3079 * @see vlc_player_SetCategoryDelay()
3080 *
3081 * @param player locked player instance
3082 * @param cat AUDIO_ES or SPU_ES
3083 * @param new_delay audio delay
3084 * @param data opaque pointer set by vlc_player_AddListener()
3085 */
3087 enum es_format_category_e cat, vlc_tick_t new_delay, void *data);
3088
3089 /**
3090 * Called when associated subtitle has changed
3091 *
3092 * @see vlc_player_SetAssociatedSubsFPS()
3093 *
3094 * @param player locked player instance
3095 * @param sub_fps subtitle fps
3096 * @param data opaque pointer set by vlc_player_AddListener()
3097 */
3099 float subs_fps, void *data);
3100
3101 /**
3102 * Called when a new renderer item is set
3103 *
3104 * @see vlc_player_SetRenderer()
3105 *
3106 * @param player locked player instance
3107 * @param new_item a valid renderer item or NULL (if unset)
3108 * @param data opaque pointer set by vlc_player_AddListener()
3109 */
3110 void (*on_renderer_changed)(vlc_player_t *player,
3111 vlc_renderer_item_t *new_item, void *data);
3112
3113 /**
3114 * Called when the player recording state has changed
3115 *
3116 * @see vlc_player_SetRecordingEnabled()
3117 *
3118 * @param player locked player instance
3119 * @param recording true if recording is enabled
3120 * @param data opaque pointer set by vlc_player_AddListener()
3121 */
3122 void (*on_recording_changed)(vlc_player_t *player,
3123 bool recording, void *data);
3124
3125 /**
3126 * Called when the media signal has changed
3127 *
3128 * @param player locked player instance
3129 * @param new_quality signal quality
3130 * @param new_strength signal strength,
3131 * @param data opaque pointer set by vlc_player_AddListener()
3132 */
3133 void (*on_signal_changed)(vlc_player_t *player,
3134 float quality, float strength, void *data);
3135
3136 /**
3137 * Called when the player has new statisics
3138 *
3139 * @note The stats structure is only valid from this callback context. It
3140 * can be copied in order to use it from an other context.
3141 *
3142 * @param player locked player instance
3143 * @param stats valid stats, only valid from this context
3144 * @param data opaque pointer set by vlc_player_AddListener()
3145 */
3146 void (*on_statistics_changed)(vlc_player_t *player,
3147 const struct input_stats_t *stats, void *data);
3148
3149 /**
3150 * Called when the A to B loop has changed
3151 *
3152 * @see vlc_player_SetAtoBLoop()
3153 *
3154 * @param player locked player instance
3155 * @param state A, when only A is set, B when both A and B are set, None by
3156 * default
3157 * @param time valid time or VLC_TICK_INVALID of the current state
3158 * @param pos valid pos of the current state
3159 * @param data opaque pointer set by vlc_player_AddListener()
3160 */
3161 void (*on_atobloop_changed)(vlc_player_t *player,
3162 enum vlc_player_abloop new_state, vlc_tick_t time, double pos,
3163 void *data);
3164
3165 /**
3166 * Called when the media meta and/or info has changed
3167 *
3168 * @param player locked player instance
3169 * @param media current media
3170 * @param data opaque pointer set by vlc_player_AddListener()
3171 */
3172 void (*on_media_meta_changed)(vlc_player_t *player,
3173 input_item_t *media, void *data);
3174
3175 /**
3176 * Called when media epg has changed
3177 *
3178 * @param player locked player instance
3179 * @param media current media
3180 * @param data opaque pointer set by vlc_player_AddListener()
3181 */
3182 void (*on_media_epg_changed)(vlc_player_t *player,
3183 input_item_t *media, void *data);
3184
3185 /**
3186 * Called when the media has new subitems
3187 *
3188 * @param player locked player instance
3189 * @param media current media
3190 * @param new_subitems node representing all media subitems
3191 * @param data opaque pointer set by vlc_player_AddListener()
3192 */
3194 input_item_t *media, input_item_node_t *new_subitems, void *data);
3195
3196 /**
3197 * Called when new attachments are added to the media
3198 *
3199 * @note It can be called several times for one parse request. The array
3200 * contains only new elements after a second call.
3201 *
3202 * @param player locked player instance
3203 * @param media current media
3204 * @param array valid array containing new elements, should only be used
3205 * within the callback. One and all elements can be held and stored on a
3206 * new variable or new array.
3207 * @param count number of elements in the array
3208 * @param data opaque pointer set by vlc_player_AddListener()
3209 */
3211 input_item_t *media, input_attachment_t *const *array, size_t count,
3212 void *data);
3213
3214 /**
3215 * Called when a vout is started or stopped
3216 *
3217 * @note In case, several media with only one video track are played
3218 * successively, the same vout instance will be started and stopped several
3219 * time.
3220 *
3221 * @param player locked player instance
3222 * @param action started or stopped
3223 * @param vout vout (can't be NULL)
3224 * @param order vout order
3225 * @param es_id the ES id associated with this vout
3226 * @param data opaque pointer set by vlc_player_AddListener()
3227 */
3228 void (*on_vout_changed)(vlc_player_t *player,
3230 enum vlc_vout_order order, vlc_es_id_t *es_id, void *data);
3231
3232 /**
3233 * Called when the player is corked
3234 *
3235 * The player can be corked when the audio output loose focus or when a
3236 * renderer was paused from the outside.
3237 *
3238 * @note called only if pause on cork was not set to true (by
3239 * vlc_player_SetPauseOnCork())
3240 * @note a cork_count higher than 0 means the player is corked. In that
3241 * case, the user should pause the player and release all external resource
3242 * needed by the player. A value higher than 1 mean that the player was
3243 * corked more than one time (for different reasons). A value of 0 means
3244 * the player is no longer corked. In that case, the user could resume the
3245 * player.
3246 *
3247 * @param player locked player instance
3248 * @param cork_count 0 for uncorked, > 0 for corked
3249 * @param data opaque pointer set by vlc_player_AddListener()
3250 */
3251 void (*on_cork_changed)(vlc_player_t *player, unsigned cork_count,
3252 void *data);
3253
3254 /**
3255 * Called to query the user about restoring the previous playback position
3256 *
3257 * If this callback isn't provided, the user won't be asked to restore
3258 * the previous playback position, effectively causing
3259 * VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK to be handled as
3260 * VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER
3261 *
3262 * The implementation can react to this callback by calling
3263 * vlc_player_RestorePlaybackPos(), or by discarding the event.
3264 *
3265 * @param player locked player instance
3266 * @param data opaque pointer set by vlc_player_AddListener()
3267 */
3268 void (*on_playback_restore_queried)(vlc_player_t *player, void *data);
3270 /**
3271 * Called when the player will stop the current media.
3272 *
3273 * @note This can be called from the PLAYING state, before the
3274 * player requests the next media, or from the STOPPING state, ie.
3275 * when the player is stopping.
3276 *
3277 * @see vlc_player_SetCurrentMedia()
3278 * @see vlc_player_Stop()
3279 *
3280 * @param player locked player instance
3281 * @param prev_media media currently stopping
3282 * @param data opaque pointer set by vlc_player_AddListener()
3283 */
3285 input_item_t *current_media, void *data);
3286};
3287
3288/**
3289 * Add a listener callback
3290 *
3291 * @note Every registered callbacks need to be removed by the caller with
3292 * vlc_player_RemoveListener().
3293 *
3294 * @param player locked player instance
3295 * @param cbs pointer to a vlc_player_cbs structure, the structure must be
3296 * valid during the lifetime of the player
3297 * @param cbs_data opaque pointer used by the callbacks
3298 * @return a valid listener id, or NULL in case of allocation error
3299 */
3302 const struct vlc_player_cbs *cbs, void *cbs_data);
3303
3304/**
3305 * Remove a listener callback
3306 *
3307 * @param player locked player instance
3308 * @param listener_id listener id returned by vlc_player_AddListener()
3309 */
3310VLC_API void
3312 vlc_player_listener_id *listener_id);
3313
3314/** @} vlc_player__events */
3315
3316/**
3317 * @defgroup vlc_player__timer Player timer
3318 * @{
3319 */
3320
3321/**
3322 * Player timer opaque structure.
3323 */
3326/**
3327 * Player timer point
3328 *
3329 * @see vlc_player_timer_cbs.on_update
3330 */
3333 /** Position in the range [0.0f;1.0] */
3334 double position;
3335 /** Rate of the player */
3336 double rate;
3337 /** Valid time >= VLC_TICK_0 or VLC_TICK_INVALID, subtract this time with
3338 * VLC_TICK_0 to get the original value. */
3339 vlc_tick_t ts;
3340 /** Valid length >= VLC_TICK_0 or VLC_TICK_INVALID */
3342 /** System date of this record (always valid), this date can be in the
3343 * future or in the past. The special value of INT64_MAX mean that the
3344 * clock was paused when this point was updated. In that case,
3345 * vlc_player_timer_point_Interpolate() will return the current ts/pos of
3346 * this point (there is nothing to interpolate). */
3349
3350/**
3351 * Player smpte timecode
3352 *
3353 * @see vlc_player_timer_smpte_cbs
3354 */
3357 /** Hours [0;n] */
3358 unsigned hours;
3359 /** Minutes [0;59] */
3360 unsigned minutes;
3361 /** Seconds [0;59] */
3362 unsigned seconds;
3363 /** Frame number [0;n] */
3364 unsigned frames;
3365 /** Maximum number of digits needed to display the frame number */
3366 unsigned frame_resolution;
3367 /** True if the source is NTSC 29.97fps or 59.94fps DF */
3368 bool drop_frame;
3370
3371/**
3372 * Player timer callbacks
3373 *
3374 * @see vlc_player_AddTimer
3375 */
3378 /**
3379 * Called when the state or the time changed (mandatory).
3380 *
3381 * Get notified when the time is updated by the input or output source. The
3382 * input source is the 'demux' or the 'access_demux'. The output source are
3383 * audio and video outputs: an update is received each time a video frame
3384 * is displayed or an audio sample is written. The delay between each
3385 * updates may depend on the input and source type (it can be every 5ms,
3386 * 30ms, 1s or 10s...). The user of this timer may need to update the
3387 * position at a higher frequency from its own mainloop via
3388 * vlc_player_timer_point_Interpolate().
3389 *
3390 * @warning The player is not locked from this callback. It is forbidden
3391 * to call any player functions from here.
3392 *
3393 * @param value always valid, the time corresponding to the state
3394 * @param data opaque pointer set by vlc_player_AddTimer()
3395 */
3396 void (*on_update)(const struct vlc_player_timer_point *value, void *data);
3398 /**
3399 * The player timer is paused (can be NULL).
3400 *
3401 * This event is sent when the player is paused or stopping. The player
3402 * user should stop its "interpolate" timer.
3403 *
3404 * @note on_update() can be called when paused for those 2 reasons:
3405 * - playback is resumed (vlc_player_timer_point.system_date is valid)
3406 * - a track, likely video (next-frame) is outputted when paused
3407 * (vlc_player_timer_point.system_date = INT64_MAX)
3408 *
3409 * @warning The player is not locked from this callback. It is forbidden
3410 * to call any player functions from here.
3411 *
3412 * @param system_date system date of this event, not valid when stopped. It
3413 * can be used to interpolate the last updated point to this date in order
3414 * to get the last paused ts/position.
3415 * @param data opaque pointer set by vlc_player_AddTimer()
3416 */
3417 void (*on_paused)(vlc_tick_t system_date, void *data);
3419 /**
3420 * Called when the player is seeking or finished seeking (can be NULL).
3421 *
3422 * @warning The player is not locked from this callback. It is forbidden
3423 * to call any player functions from here.
3424 *
3425 * @note on_update() can be called when seeking. It corresponds to tracks
3426 * updating their points prior to receiving the asynchronous seek event.
3427 * The user could discard them manually.
3428 *
3429 * @param value point of the seek request or NULL when seeking is finished
3430 * @param data opaque pointer set by vlc_player_AddTimer()
3431 */
3432 void (*on_seek)(const struct vlc_player_timer_point *value, void *data);
3434
3435/**
3436 * Player smpte timer callbacks
3437 *
3438 * @see vlc_player_AddSmpteTimer
3439 */
3442 /**
3443 * Called when a new frame is displayed
3444
3445 * @warning The player is not locked from this callback. It is forbidden
3446 * to call any player functions from here.
3447 *
3448 * @param tc always valid, the timecode corresponding to the frame just
3449 * displayed
3450 * @param data opaque pointer set by vlc_player_AddTimer()
3451 */
3452 void (*on_update)(const struct vlc_player_timer_smpte_timecode *tc,
3453 void *data);
3454};
3455
3456/**
3457 * Add a timer in order to get times updates
3458 *
3459 * @param player player instance (locked or not)
3460 * @param min_period corresponds to the minimum period between each updates,
3461 * use it to avoid flood from too many source updates, set it to
3462 * VLC_TICK_INVALID to receive all updates.
3463 * @param cbs pointer to a vlc_player_timer_cbs structure, the structure must
3464 * be valid during the lifetime of the player
3465 * @param cbs_data opaque pointer used by the callbacks
3466 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3467 * error
3468 */
3470vlc_player_AddTimer(vlc_player_t *player, vlc_tick_t min_period,
3471 const struct vlc_player_timer_cbs *cbs,
3472 void *cbs_data);
3473
3474/**
3475 * Add a smpte timer in order to get accurate video frame updates
3476 *
3477 * @param player player instance (locked or not)
3478 * @param cbs pointer to a vlc_player_timer_smpte_cbs structure, the structure must
3479 * be valid during the lifetime of the player
3480 * @param cbs_data opaque pointer used by the callbacks
3481 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3482 * error
3483 */
3486 const struct vlc_player_timer_smpte_cbs *cbs,
3487 void *cbs_data);
3488
3489/**
3490 * Remove a player timer
3491 *
3492 * @param player player instance (locked or not)
3493 * @param timer timer created by vlc_player_AddTimer()
3494 */
3495VLC_API void
3497
3498/**
3499 * Interpolate the last timer value to now
3500 *
3501 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3502 * callback
3503 * @param system_now current system date
3504 * @param out_ts pointer where to set the interpolated ts, subtract this time
3505 * with VLC_TICK_0 to get the original value.
3506 * @param out_pos pointer where to set the interpolated position
3507 * @return VLC_SUCCESS in case of success, an error in the interpolated ts is
3508 * negative (could happen during the buffering step)
3509 */
3510VLC_API int
3512 vlc_tick_t system_now,
3513 vlc_tick_t *out_ts, double *out_pos);
3514
3515/**
3516 * Get the date of the next interval
3517 *
3518 * Can be used to setup an UI timer in order to update some widgets at specific
3519 * interval. A next_interval of VLC_TICK_FROM_SEC(1) can be used to update a
3520 * time widget when the media reaches a new second.
3521 *
3522 * @note The media time doesn't necessarily correspond to the system time, that
3523 * is why this function is needed and use the rate of the current point.
3524 *
3525 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3526 * @param system_now current system date
3527 * @param interpolated_ts ts returned by vlc_player_timer_point_Interpolate()
3528 * with the same system now
3529 * @param next_interval next interval
3530 * @return the absolute system date of the next interval
3531 */
3534 vlc_tick_t system_now,
3535 vlc_tick_t interpolated_ts,
3536 vlc_tick_t next_interval);
3537
3538/** @} vlc_player__timer */
3539
3540/** @} vlc_player */
3541
3542#endif
size_t count
Definition core.c:403
#define VLC_API
Definition fourcc_gen.c:31
#define VLC_DEPRECATED
Definition vlc_common.h:158
vlc_vout_order
vout or spu_channel order
Definition vlc_vout.h:70
audio_output_t * vlc_player_aout_Hold(vlc_player_t *player)
Get the audio output.
Definition aout.c:44
static int vlc_player_aout_DecrementVolume(vlc_player_t *player, int steps, float *result)
Helper to decrement the audio volume.
Definition vlc_player.h:2471
int vlc_player_aout_SetVolume(vlc_player_t *player, float volume)
Set the audio volume.
Definition aout.c:135
vlc_player_aout_listener_id * vlc_player_aout_AddListener(vlc_player_t *player, const struct vlc_player_aout_cbs *cbs, void *cbs_data)
Add a listener callback for audio output events.
Definition aout.c:50
int vlc_player_aout_Mute(vlc_player_t *player, bool mute)
Mute or unmute the audio output.
Definition aout.c:171
int vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result)
Increment the audio volume.
Definition aout.c:147
float vlc_player_aout_GetVolume(vlc_player_t *player)
Get the audio volume.
Definition aout.c:123
void vlc_player_aout_Reset(vlc_player_t *player)
Reset the main audio output.
Definition aout.c:242
void vlc_player_aout_RemoveListener(vlc_player_t *player, vlc_player_aout_listener_id *listener_id)
Remove a aout listener callback.
Definition aout.c:71
static int vlc_player_aout_ToggleMute(vlc_player_t *player)
Helper to toggle the mute state.
Definition vlc_player.h:2510
int vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add)
Enable or disable an audio filter.
Definition aout.c:183
int vlc_player_aout_IsMuted(vlc_player_t *player)
Check if the audio output is muted.
Definition aout.c:159
vlc_player_list_action
Action of vlc_player_cbs.on_track_list_changed, vlc_player_cbs.on_program_list_changed callbacks.
Definition vlc_player.h:2772
vlc_player_listener_id * vlc_player_AddListener(vlc_player_t *player, const struct vlc_player_cbs *cbs, void *cbs_data)
Add a listener callback.
Definition player.c:968
void vlc_player_RemoveListener(vlc_player_t *player, vlc_player_listener_id *listener_id)
Remove a listener callback.
Definition player.c:987
@ VLC_PLAYER_LIST_ADDED
Definition vlc_player.h:2773
@ VLC_PLAYER_LIST_UPDATED
Definition vlc_player.h:2775
@ VLC_PLAYER_LIST_REMOVED
Definition vlc_player.h:2774
vlc_player_t * vlc_player_New(vlc_object_t *parent, enum vlc_player_lock_type lock_type)
Create a new player instance.
Definition player.c:1991
void vlc_player_SetPauseOnCork(vlc_player_t *player, bool enabled)
Enable or disable pause on cork event.
Definition player.c:1870
void vlc_player_CondWait(vlc_player_t *player, vlc_cond_t *cond)
Wait on a condition variable.
Definition player.c:961
void vlc_player_Delete(vlc_player_t *player)
Delete a player instance.
Definition player.c:1938
void vlc_player_Unlock(vlc_player_t *player)
Unlock the player.
Definition player.c:955
void vlc_player_Lock(vlc_player_t *player)
Lock the player.
Definition player.c:939
vlc_player_lock_type
Player lock type (normal or reentrant)
Definition vlc_player.h:72
void vlc_player_SetStartPaused(vlc_player_t *player, bool start_paused)
Ask to start in a paused state.
Definition player.c:1240
@ VLC_PLAYER_LOCK_REENTRANT
Reentrant lock.
Definition vlc_player.h:88
@ VLC_PLAYER_LOCK_NORMAL
Normal lock.
Definition vlc_player.h:79
vlc_player_metadata_listener_id * vlc_player_AddMetadataListener(vlc_player_t *player, enum vlc_player_metadata_option option, const union vlc_player_metadata_cbs *cbs, void *cbs_data)
Add a metadata listener.
Definition metadata.c:158
void vlc_player_RemoveMetadataListener(vlc_player_t *player, vlc_player_metadata_listener_id *listener_id)
Remove a metadata listener.
Definition metadata.c:201
vlc_player_metadata_option
Player metadata option.
Definition vlc_player.h:2219
@ VLC_PLAYER_METADATA_LOUDNESS_MOMENTARY
Ask for momentary loudness measurement.
Definition vlc_player.h:2226
@ VLC_PLAYER_METADATA_LOUDNESS_FULL
Ask for all loudness measurements.
Definition vlc_player.h:2234
vlc_player_state
State of the player.
Definition vlc_player.h:193
void vlc_player_NextVideoFrame(vlc_player_t *player)
Pause and display the next video frame.
Definition player.c:1275
static bool vlc_player_CanPause(vlc_player_t *player)
Helper to get the pause capability.
Definition vlc_player.h:549
void vlc_player_ChangeRate(vlc_player_t *player, float rate)
Change the rate of the player.
Definition player.c:1318
int vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
Set the current media.
Definition player.c:1009
vlc_player_abloop
A to B loop state.
Definition vlc_player.h:300
void vlc_player_Resume(vlc_player_t *player)
Resume the playback from a pause.
Definition player.c:1269
vlc_tick_t vlc_player_GetTime(vlc_player_t *player)
Get the time of the current media.
Definition player.c:1382
static input_item_t * vlc_player_HoldCurrentMedia(vlc_player_t *player)
Helper that hold the current media.
Definition vlc_player.h:403
vlc_player_restore_playback_pos
Definition vlc_player.h:327
static void vlc_player_SetTime(vlc_player_t *player, vlc_tick_t time)
Helper to set the absolute time precisely.
Definition vlc_player.h:720
void vlc_player_Navigate(vlc_player_t *player, enum vlc_player_nav nav)
Navigate (for DVD/Bluray menus or viewpoint)
Definition player.c:1618
int vlc_player_SetAtoBLoop(vlc_player_t *player, enum vlc_player_abloop abloop)
Enable A to B loop of the current media.
Definition player.c:1461
static bool vlc_player_CanSeek(vlc_player_t *player)
Helper to get the seek capability.
Definition vlc_player.h:540
static void vlc_player_ToggleRecording(vlc_player_t *player)
Helper to toggle the recording state.
Definition vlc_player.h:880
static void vlc_player_TogglePause(vlc_player_t *player)
Helper to toggle the pause state.
Definition vlc_player.h:512
#define VLC_PLAYER_CAP_SEEK
Player capability: can seek.
Definition vlc_player.h:307
void vlc_player_IncrementRate(vlc_player_t *player)
Increment the rate of the player (faster)
Definition player.c:1363
int vlc_player_GetCapabilities(vlc_player_t *player)
Get the player capabilities.
Definition player.c:1301
vlc_player_whence
Player seek/delay directive.
Definition vlc_player.h:266
static void vlc_player_JumpPos(vlc_player_t *player, double jumppos)
Helper to jump the position precisely.
Definition vlc_player.h:708
float vlc_player_GetRate(vlc_player_t *player)
Get the rate of the player.
Definition player.c:1308
void vlc_player_RestorePlaybackPos(vlc_player_t *player)
Restore the previous playback position of the current media.
Definition medialib.c:296
static void vlc_player_SetPositionFast(vlc_player_t *player, double position)
Helper to set the absolute position fast.
Definition vlc_player.h:698
void vlc_player_Pause(vlc_player_t *player)
Pause the playback.
Definition player.c:1263
vlc_player_seek_speed
Seek speed type.
Definition vlc_player.h:251
void vlc_player_UpdateViewpoint(vlc_player_t *player, const vlc_viewpoint_t *viewpoint, enum vlc_player_whence whence)
Update the viewpoint.
Definition player.c:1656
static void vlc_player_SetTimeFast(vlc_player_t *player, vlc_tick_t time)
Helper to set the absolute time fast.
Definition vlc_player.h:730
int vlc_player_Stop(vlc_player_t *player)
Stop the playback of the current media.
Definition player.c:1222
bool vlc_player_IsRecording(vlc_player_t *player)
Check if the playing is recording.
Definition player.c:1666
int vlc_player_Start(vlc_player_t *player)
Start the playback of the current media.
Definition player.c:1152
static bool vlc_player_CanRewind(vlc_player_t *player)
Helper to get the rewindable capability.
Definition vlc_player.h:567
input_item_t * vlc_player_GetNextMedia(vlc_player_t *player)
Get the next played media.
Definition player.c:1064
#define VLC_PLAYER_CAP_REWIND
Player capability: can seek back.
Definition vlc_player.h:313
static void vlc_player_SetPosition(vlc_player_t *player, double position)
Helper to set the absolute position precisely.
Definition vlc_player.h:688
static bool vlc_player_IsStarted(vlc_player_t *player)
Helper to get the started state.
Definition vlc_player.h:486
input_item_t * vlc_player_GetCurrentMedia(vlc_player_t *player)
Get the current played media.
Definition player.c:1072
void vlc_player_SeekByTime(vlc_player_t *player, vlc_tick_t time, enum vlc_player_seek_speed speed, enum vlc_player_whence whence)
Seek the current media by time.
Definition player.c:1424
enum vlc_player_abloop vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, double *a_pos, vlc_tick_t *b_time, double *b_pos)
Get the A to B loop status.
Definition player.c:1595
void vlc_player_DecrementRate(vlc_player_t *player)
Decrement the rate of the player (Slower)
Definition player.c:1369
#define VLC_PLAYER_CAP_PAUSE
Player capability: can pause.
Definition vlc_player.h:309
static bool vlc_player_IsPaused(vlc_player_t *player)
Helper to get the paused state.
Definition vlc_player.h:503
const struct input_stats_t * vlc_player_GetStatistics(vlc_player_t *player)
Get the statistics of the current media.
Definition player.c:1862
void vlc_player_DisplayPosition(vlc_player_t *player)
Display the player position on the vout OSD.
Definition player.c:1401
vlc_player_nav
Menu (VCD/DVD/BD) and viewpoint navigations.
Definition vlc_player.h:279
enum vlc_player_state vlc_player_GetState(vlc_player_t *player)
Get the state of the player.
Definition player.c:1287
vlc_player_error
Error of the player.
Definition vlc_player.h:239
int vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength)
Get the signal quality and strength of the current media.
Definition player.c:1847
vlc_object_t * vlc_player_GetV4l2Object(vlc_player_t *player)
Get the V4L2 object used to do controls.
Definition player.c:1915
static bool vlc_player_CanChangeRate(vlc_player_t *player)
Helper to get the change-rate capability.
Definition vlc_player.h:558
vlc_tick_t vlc_player_GetLength(vlc_player_t *player)
Get the length of the current media.
Definition player.c:1375
static void vlc_player_JumpTime(vlc_player_t *player, vlc_tick_t jumptime)
Helper to jump the time precisely.
Definition vlc_player.h:740
void vlc_player_SeekByPos(vlc_player_t *player, double position, enum vlc_player_seek_speed speed, enum vlc_player_whence whence)
Seek the current media by position.
Definition player.c:1414
void vlc_player_SetNextMedia(vlc_player_t *player, input_item_t *media)
Set the next media.
Definition player.c:1050
int vlc_player_SetAtoBLoopTime(vlc_player_t *player, vlc_tick_t a_time, vlc_tick_t b_time)
Enable A to B loop of the current media by setting start and end time.
Definition player.c:1518
double vlc_player_GetPosition(vlc_player_t *player)
Get the position of the current media.
Definition player.c:1393
int vlc_player_ResetAtoBLoop(vlc_player_t *player)
Reset/remove the A to B loop of the current media.
Definition player.c:1577
void vlc_player_SetRecordingEnabled(vlc_player_t *player, bool enabled, const char *dir_path)
Enable or disable recording for the current media.
Definition player.c:1674
int vlc_player_AddAssociatedMedia(vlc_player_t *player, enum es_format_category_e cat, const char *uri, bool select, bool notify, bool check_ext)
Add an associated (or external) media to the current media.
Definition player.c:1080
enum vlc_player_error vlc_player_GetError(vlc_player_t *player)
Get the error state of the player.
Definition player.c:1294
#define VLC_PLAYER_CAP_CHANGE_RATE
Player capability: can change the rate.
Definition vlc_player.h:311
int vlc_player_SetAtoBLoopPosition(vlc_player_t *player, double a_pos, double b_pos)
Enable A to B loop of the current media by setting start and end position.
Definition player.c:1549
@ VLC_PLAYER_STATE_STOPPED
The player is stopped.
Definition vlc_player.h:200
@ VLC_PLAYER_STATE_PAUSED
The player is paused.
Definition vlc_player.h:222
@ VLC_PLAYER_STATE_STOPPING
The player is stopping.
Definition vlc_player.h:230
@ VLC_PLAYER_STATE_STARTED
The player is started.
Definition vlc_player.h:207
@ VLC_PLAYER_STATE_PLAYING
The player is playing.
Definition vlc_player.h:215
@ VLC_PLAYER_ABLOOP_B
Definition vlc_player.h:303
@ VLC_PLAYER_ABLOOP_A
Definition vlc_player.h:302
@ VLC_PLAYER_ABLOOP_NONE
Definition vlc_player.h:301
@ VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER
Definition vlc_player.h:328
@ VLC_PLAYER_RESTORE_PLAYBACK_POS_ALWAYS
Definition vlc_player.h:330
@ VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK
Definition vlc_player.h:329
@ VLC_PLAYER_WHENCE_RELATIVE
The current position +/- the given time/position.
Definition vlc_player.h:270
@ VLC_PLAYER_WHENCE_ABSOLUTE
Given time/position.
Definition vlc_player.h:268
@ VLC_PLAYER_SEEK_FAST
Do a fast seek.
Definition vlc_player.h:255
@ VLC_PLAYER_SEEK_PRECISE
Do a precise seek.
Definition vlc_player.h:253
@ VLC_PLAYER_NAV_RIGHT
Select a navigation item on the right or move the viewpoint right.
Definition vlc_player.h:289
@ VLC_PLAYER_NAV_UP
Select a navigation item above or move the viewpoint up.
Definition vlc_player.h:283
@ VLC_PLAYER_NAV_POPUP
Activate the popup Menu (for BD)
Definition vlc_player.h:291
@ VLC_PLAYER_NAV_MENU
Activate disc Root Menu.
Definition vlc_player.h:293
@ VLC_PLAYER_NAV_ACTIVATE
Activate the navigation item selected.
Definition vlc_player.h:281
@ VLC_PLAYER_NAV_LEFT
Select a navigation item on the left or move the viewpoint left.
Definition vlc_player.h:287
@ VLC_PLAYER_NAV_DOWN
Select a navigation item under or move the viewpoint down.
Definition vlc_player.h:285
@ VLC_PLAYER_ERROR_GENERIC
Definition vlc_player.h:241
@ VLC_PLAYER_ERROR_NONE
Definition vlc_player.h:240
static const struct vlc_player_program * vlc_player_GetSelectedProgram(vlc_player_t *player)
Helper to get the current selected program.
Definition vlc_player.h:1295
const struct vlc_player_program * vlc_player_GetProgramAt(vlc_player_t *player, size_t index)
Get the program at a specific index.
Definition player.c:257
void vlc_player_SelectNextProgram(vlc_player_t *player)
Select the next program.
Definition player.c:332
size_t vlc_player_GetProgramCount(vlc_player_t *player)
Get the number of programs.
Definition player.c:249
void vlc_player_SelectPrevProgram(vlc_player_t *player)
Select the previous program.
Definition player.c:338
void vlc_player_SelectProgram(vlc_player_t *player, int group_id)
Select a program from an ES group identifier.
Definition player.c:282
struct vlc_player_program * vlc_player_program_Dup(const struct vlc_player_program *prgm)
Duplicate a program.
Definition track.c:69
const struct vlc_player_program * vlc_player_GetProgram(vlc_player_t *player, int group_id)
Get a program from an ES group identifier.
Definition player.c:269
void vlc_player_program_Delete(struct vlc_player_program *prgm)
Delete a duplicated program.
Definition track.c:82
vlc_renderer_item_t * vlc_player_GetRenderer(vlc_player_t *player)
Get the renderer.
Definition player.c:1454
void vlc_player_SetRenderer(vlc_player_t *player, vlc_renderer_item_t *renderer)
Set the renderer.
Definition player.c:1434
void vlc_player_SetTeletextTransparency(vlc_player_t *player, bool enabled)
Enable or disable teletext transparency.
Definition player.c:765
void vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page)
Select a teletext page or do an action from a key.
Definition player.c:752
unsigned vlc_player_GetTeletextPage(vlc_player_t *player)
Get the current teletext page.
Definition player.c:798
bool vlc_player_HasTeletextMenu(vlc_player_t *player)
Check if the media has a teletext menu.
Definition player.c:779
void vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled)
Enable or disable teletext.
Definition player.c:739
bool vlc_player_IsTeletextEnabled(vlc_player_t *player)
Check if teletext is enabled.
Definition player.c:786
bool vlc_player_IsTeletextTransparent(vlc_player_t *player)
Check if teletext is transparent.
Definition player.c:805
vlc_player_timer_id * vlc_player_AddTimer(vlc_player_t *player, vlc_tick_t min_period, const struct vlc_player_timer_cbs *cbs, void *cbs_data)
Add a timer in order to get times updates.
Definition timer.c:562
void vlc_player_RemoveTimer(vlc_player_t *player, vlc_player_timer_id *timer)
Remove a player timer.
Definition timer.c:606
int vlc_player_timer_point_Interpolate(const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t *out_ts, double *out_pos)
Interpolate the last timer value to now.
Definition timer.c:618
vlc_tick_t vlc_player_timer_point_GetNextIntervalDate(const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t interpolated_ts, vlc_tick_t next_interval)
Get the date of the next interval.
Definition timer.c:659
vlc_player_timer_id * vlc_player_AddSmpteTimer(vlc_player_t *player, const struct vlc_player_timer_smpte_cbs *cbs, void *cbs_data)
Add a smpte timer in order to get accurate video frame updates.
Definition timer.c:584
vlc_player_title_list * vlc_player_title_list_Hold(vlc_player_title_list *titles)
Hold the title list of the player.
Definition title.c:32
void vlc_player_SelectPrevChapter(vlc_player_t *player)
Select the previous chapter for the current media.
Definition player.c:927
vlc_player_title_list * vlc_player_GetTitleList(vlc_player_t *player)
Get the title list of the current media.
Definition player.c:812
static const struct vlc_player_chapter * vlc_player_GetSelectedChapter(vlc_player_t *player)
Helper to get the current selected chapter.
Definition vlc_player.h:1138
const struct vlc_player_title * vlc_player_title_list_GetAt(vlc_player_title_list *titles, size_t idx)
Get the title at a given index.
Definition title.c:165
ssize_t vlc_player_GetSelectedChapterIdx(vlc_player_t *player)
Get the selected chapter index for the current media.
Definition player.c:893
void vlc_player_SelectNextChapter(vlc_player_t *player)
Select the next chapter for the current media.
Definition player.c:915
void vlc_player_SelectNextTitle(vlc_player_t *player)
Select the next title for the current media.
Definition player.c:869
void vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index)
Select a chapter index for the current media.
Definition player.c:903
void vlc_player_SelectTitle(vlc_player_t *player, const struct vlc_player_title *title)
Select a title for the current media.
Definition player.c:850
void vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index)
Select a title index for the current media.
Definition player.c:841
void vlc_player_title_list_Release(vlc_player_title_list *titles)
Release of previously held title list.
Definition title.c:39
size_t vlc_player_title_list_GetCount(vlc_player_title_list *titles)
Get the number of title of a list.
Definition title.c:172
void vlc_player_SelectChapter(vlc_player_t *player, const struct vlc_player_title *title, size_t chapter_idx)
Select a chapter for the current media.
Definition player.c:859
static const struct vlc_player_title * vlc_player_GetSelectedTitle(vlc_player_t *player)
Helper to get the current selected title.
Definition vlc_player.h:1051
void vlc_player_SelectPrevTitle(vlc_player_t *player)
Select the previous title for the current media.
Definition player.c:881
ssize_t vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
Get the selected title index for the current media.
Definition player.c:819
static void vlc_player_SetSubtitleDelay(vlc_player_t *player, vlc_tick_t delay, enum vlc_player_whence whence)
Helper to set the subtitle delay.
Definition vlc_player.h:2041
void vlc_player_SetAssociatedSubsFPS(vlc_player_t *player, float fps)
Set the associated subtitle FPS.
Definition player.c:1133
static vlc_tick_t vlc_player_GetVideoDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:2012
int vlc_player_SetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id, vlc_tick_t delay, enum vlc_player_whence whence)
Set the delay of one track.
Definition player.c:1745
float vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
Get the associated subtitle FPS.
Definition player.c:1145
static vlc_tick_t vlc_player_GetAudioDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:1992
static vlc_tick_t vlc_player_GetSubtitleDelay(vlc_player_t *player)
Helper to get the subtitle delay.
Definition vlc_player.h:2032
static void vlc_player_SetAudioDelay(vlc_player_t *player, vlc_tick_t delay, enum vlc_player_whence whence)
Helper to set the audio delay.
Definition vlc_player.h:2001
static void vlc_player_SetVideoDelay(vlc_player_t *player, vlc_tick_t delay, enum vlc_player_whence whence)
Helper to set the audio delay.
Definition vlc_player.h:2021
int vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat, vlc_tick_t delay, enum vlc_player_whence whence)
Set the delay of one category for the current media.
Definition player.c:1700
vlc_tick_t vlc_player_GetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat)
Get the delay of an ES category for the current media.
Definition player.c:1732
vlc_tick_t vlc_player_GetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id)
Get the delay of a track.
Definition player.c:1785
size_t vlc_player_GetTrackCount(vlc_player_t *player, enum es_format_category_e cat)
Get the number of tracks for an ES category.
Definition player.c:344
const struct vlc_player_track * vlc_player_GetTrackAt(vlc_player_t *player, enum es_format_category_e cat, size_t index)
Get the track at a specific index for an ES category.
Definition player.c:357
vout_thread_t * vlc_player_GetEsIdVout(vlc_player_t *player, vlc_es_id_t *es_id, enum vlc_vout_order *order)
Get and the video output used by a ES identifier.
Definition player.c:395
struct vlc_player_track * vlc_player_track_Dup(const struct vlc_player_track *track)
Duplicate a track.
Definition track.c:157
static bool vlc_player_IsAudioEnabled(vlc_player_t *player)
Helper to check if audio tracks are enabled.
Definition vlc_player.h:1863
static const struct vlc_player_track * vlc_player_GetSelectedTrack(vlc_player_t *player, enum es_format_category_e cat)
Helper to get the selected track from an ES category.
Definition vlc_player.h:1526
static void vlc_player_RestartTrackCategory(vlc_player_t *player, enum es_format_category_e cat)
Helper to restart all selected tracks from an ES category.
Definition vlc_player.h:1744
void vlc_player_RestartEsId(vlc_player_t *player, vlc_es_id_t *es_id)
Restart a track from an ES identifier.
Definition player.c:695
static const struct vlc_player_track * vlc_player_GetAudioTrackAt(vlc_player_t *player, size_t index)
Helper to get an audio track at a specific index.
Definition vlc_player.h:1443
void vlc_player_SelectTracksByStringIds(vlc_player_t *player, enum es_format_category_e cat, const char *str_ids)
Select tracks by their string identifier.
Definition player.c:577
unsigned vlc_player_GetSubtitleTextScale(vlc_player_t *player)
Get the subtitle text scaling factor.
Definition player.c:1841
static void vlc_player_UnselectTrackCategory(vlc_player_t *player, enum es_format_category_e cat)
Helper to unselect all tracks from an ES category.
Definition vlc_player.h:1703
static void vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable audio tracks.
Definition vlc_player.h:1854
void vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order, bool next)
Cycle through the tracks.
Definition player.c:601
void vlc_player_track_Delete(struct vlc_player_track *track)
Delete a duplicated track.
Definition track.c:149
static const struct vlc_player_track * vlc_player_GetSubtitleTrackAt(vlc_player_t *player, size_t index)
Helper to get a subtitle track at a specific index.
Definition vlc_player.h:1461
static void vlc_player_RestartTrack(vlc_player_t *player, const struct vlc_player_track *track)
Helper to restart a track.
Definition vlc_player.h:1734
unsigned vlc_player_SelectEsIdList(vlc_player_t *player, enum es_format_category_e cat, vlc_es_id_t *const es_id_list[])
Select multiple tracks from a list of ES identifiers.
Definition player.c:436
static size_t vlc_player_GetSubtitleTrackCount(vlc_player_t *player)
Helper to get the subtitle track count.
Definition vlc_player.h:1452
vlc_es_id_t * vlc_player_GetEsIdFromVout(vlc_player_t *player, vout_thread_t *vout)
Get the ES identifier of a video output.
Definition player.c:410
void vlc_player_UnselectEsId(vlc_player_t *player, vlc_es_id_t *es_id)
Unselect a track from an ES identifier.
Definition player.c:674
vlc_player_select_policy
Player selection policy.
Definition vlc_player.h:1322
static size_t vlc_player_GetAudioTrackCount(vlc_player_t *player)
Helper to get the audio track count.
Definition vlc_player.h:1434
char * vlc_player_GetCategoryLanguage(vlc_player_t *player, enum es_format_category_e cat)
Get the language of an ES category.
Definition player.c:723
static void vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable subtitle tracks.
Definition vlc_player.h:1872
static void vlc_player_SelectPrevTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order)
Helper to select the Previous track.
Definition vlc_player.h:1668
static void vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable video tracks.
Definition vlc_player.h:1836
void vlc_player_SelectCategoryLanguage(vlc_player_t *player, enum es_format_category_e cat, const char *lang)
Select the language for an ES category.
Definition player.c:704
static bool vlc_player_IsVideoEnabled(vlc_player_t *player)
Helper to check if video tracks are enabled.
Definition vlc_player.h:1845
static size_t vlc_player_GetVideoTrackCount(vlc_player_t *player)
Helper to get the video track count.
Definition vlc_player.h:1416
bool vlc_player_IsTrackCategoryEnabled(vlc_player_t *player, enum es_format_category_e cat)
Check if a track category is enabled.
Definition player.c:1826
static void vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
Helper to select the subtitle language.
Definition vlc_player.h:1803
static const struct vlc_player_track * vlc_player_GetVideoTrackAt(vlc_player_t *player, size_t index)
Helper to get a video track at a specific index.
Definition vlc_player.h:1425
void vlc_player_SetTrackCategoryEnabled(vlc_player_t *player, enum es_format_category_e cat, bool enabled)
Enable or disable a track category.
Definition player.c:1806
static void vlc_player_ToggleSubtitle(vlc_player_t *player)
Helper to toggle subtitles.
Definition vlc_player.h:1890
static unsigned vlc_player_SelectTrack(vlc_player_t *player, const struct vlc_player_track *track, enum vlc_player_select_policy policy)
Helper to select a track.
Definition vlc_player.h:1590
static void vlc_player_SelectNextTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order)
Helper to select the next track.
Definition vlc_player.h:1651
const struct vlc_player_track * vlc_player_GetTrack(vlc_player_t *player, vlc_es_id_t *es_id)
Get a track from an ES identifier.
Definition player.c:387
static void vlc_player_SelectAudioLanguage(vlc_player_t *player, const char *lang)
Helper to select the audio language.
Definition vlc_player.h:1794
void vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale)
Set the subtitle text scaling factor.
Definition player.c:1834
unsigned vlc_player_SelectEsId(vlc_player_t *player, vlc_es_id_t *es_id, enum vlc_player_select_policy policy)
Select a track from an ES identifier.
Definition player.c:550
static void vlc_player_UnselectTrack(vlc_player_t *player, const struct vlc_player_track *track)
Helper to unselect a track.
Definition vlc_player.h:1693
static bool vlc_player_IsSubtitleEnabled(vlc_player_t *player)
Helper to check if subtitle tracks are enabled.
Definition vlc_player.h:1881
@ VLC_PLAYER_SELECT_SIMULTANEOUS
Select multiple tracks for one category.
Definition vlc_player.h:1335
@ VLC_PLAYER_SELECT_EXCLUSIVE
Only one track per category is selected.
Definition vlc_player.h:1327
vlc_player_vout_listener_id * vlc_player_vout_AddListener(vlc_player_t *player, const struct vlc_player_vout_cbs *cbs, void *cbs_data)
Add a listener callback for video output events.
Definition vout.c:68
void vlc_player_vout_SetFullscreen(vlc_player_t *player, bool enabled)
Enable or disable the player fullscreen state.
Definition vout.c:181
void vlc_player_vout_RemoveListener(vlc_player_t *player, vlc_player_vout_listener_id *listener_id)
Remove a vout listener callback.
Definition vout.c:89
void vlc_player_vout_Snapshot(vlc_player_t *player)
Take a snapshot on all vouts.
Definition vout.c:206
vlc_player_vout_action
action of vlc_player_cbs.on_vout_changed callback
Definition vlc_player.h:2545
void vlc_player_osd_Message(vlc_player_t *player, const char *fmt,...)
Display an OSD message on all vouts.
Definition osd.c:90
static void vlc_player_vout_ToggleFullscreen(vlc_player_t *player)
Helper to toggle the player fullscreen state.
Definition vlc_player.h:2686
vout_thread_t * vlc_player_vout_Hold(vlc_player_t *player)
Get and hold the main video output.
Definition vout.c:43
static void vlc_player_vout_ToggleWallpaperMode(vlc_player_t *player)
Helper to toggle the player wallpaper-mode state.
Definition vlc_player.h:2729
void vlc_player_vout_SetWallpaperModeEnabled(vlc_player_t *player, bool enabled)
Enable or disable the player wallpaper-mode.
Definition vout.c:198
vout_thread_t ** vlc_player_vout_HoldAll(vlc_player_t *player, size_t *count)
Get and hold the list of video output.
Definition vout.c:50
bool vlc_player_vout_IsWallpaperModeEnabled(vlc_player_t *player)
Check if the player has wallpaper-mode enaled.
Definition vout.c:189
bool vlc_player_vout_IsFullscreen(vlc_player_t *player)
Check if the player is fullscreen.
Definition vout.c:101
@ VLC_PLAYER_VOUT_STOPPED
Definition vlc_player.h:2547
@ VLC_PLAYER_VOUT_STARTED
Definition vlc_player.h:2546
const char name[16]
Definition httpd.c:1298
input_item_t * input_item_Hold(input_item_t *p_item)
Holds an input item, i.e.
Definition item.c:401
Audio output object.
Definition vlc_aout.h:155
Definition vlc_es.h:614
Definition vlc_input.h:168
Definition vlc_input_item.h:204
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
Definition vlc_input_item.h:529
Audio loudness measurement.
Definition vlc_aout.h:667
Condition variable.
Definition vlc_threads.h:270
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:105
VLC object common members.
Definition vlc_objects.h:53
Player aout callbacks.
Definition vlc_player.h:2336
void(* on_volume_changed)(audio_output_t *aout, float new_volume, void *data)
Called when the volume has changed.
Definition vlc_player.h:2346
void(* on_mute_changed)(audio_output_t *aout, bool new_muted, void *data)
Called when the mute state has changed.
Definition vlc_player.h:2358
void(* on_device_changed)(audio_output_t *aout, const char *device, void *data)
Called when the audio device has changed.
Definition vlc_player.h:2368
Definition player.h:159
Player callbacks.
Definition vlc_player.h:2793
void(* on_program_list_changed)(vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_program *prgm, void *data)
Called when a new program is added, removed or updated.
Definition vlc_player.h:2960
void(* on_length_changed)(vlc_player_t *player, vlc_tick_t new_length, void *data)
Called when the media length has changed.
Definition vlc_player.h:2904
void(* on_stopping_current_media)(vlc_player_t *player, input_item_t *current_media, void *data)
Called when the player will stop the current media.
Definition vlc_player.h:3285
void(* on_recording_changed)(vlc_player_t *player, bool recording, void *data)
Called when the player recording state has changed.
Definition vlc_player.h:3123
void(* on_media_subitems_changed)(vlc_player_t *player, input_item_t *media, input_item_node_t *new_subitems, void *data)
Called when the media has new subitems.
Definition vlc_player.h:3194
void(* on_category_delay_changed)(vlc_player_t *player, enum es_format_category_e cat, vlc_tick_t new_delay, void *data)
Called when the player category delay has changed for the current media.
Definition vlc_player.h:3087
void(* on_teletext_page_changed)(vlc_player_t *player, unsigned new_page, void *data)
Called when the teletext page has changed.
Definition vlc_player.h:3062
void(* on_capabilities_changed)(vlc_player_t *player, int old_caps, int new_caps, void *data)
Called when the media capabilities has changed.
Definition vlc_player.h:2877
void(* on_signal_changed)(vlc_player_t *player, float quality, float strength, void *data)
Called when the media signal has changed.
Definition vlc_player.h:3134
void(* on_title_selection_changed)(vlc_player_t *player, const struct vlc_player_title *new_title, size_t new_idx, void *data)
Called when a new title is selected.
Definition vlc_player.h:3008
void(* on_current_media_changed)(vlc_player_t *player, input_item_t *new_media, void *data)
Called when the current media has changed.
Definition vlc_player.h:2811
void(* on_teletext_menu_changed)(vlc_player_t *player, bool has_teletext_menu, void *data)
Called when the media has a teletext menu.
Definition vlc_player.h:3038
void(* on_statistics_changed)(vlc_player_t *player, const struct input_stats_t *stats, void *data)
Called when the player has new statisics.
Definition vlc_player.h:3147
void(* on_media_meta_changed)(vlc_player_t *player, input_item_t *media, void *data)
Called when the media meta and/or info has changed.
Definition vlc_player.h:3173
void(* on_track_selection_changed)(vlc_player_t *player, vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data)
Called when a new track is selected and/or unselected.
Definition vlc_player.h:2934
void(* on_associated_subs_fps_changed)(vlc_player_t *player, float subs_fps, void *data)
Called when associated subtitle has changed.
Definition vlc_player.h:3099
void(* on_media_epg_changed)(vlc_player_t *player, input_item_t *media, void *data)
Called when media epg has changed.
Definition vlc_player.h:3183
void(* on_vout_changed)(vlc_player_t *player, enum vlc_player_vout_action action, vout_thread_t *vout, enum vlc_vout_order order, vlc_es_id_t *es_id, void *data)
Called when a vout is started or stopped.
Definition vlc_player.h:3229
void(* on_program_selection_changed)(vlc_player_t *player, int unselected_id, int selected_id, void *data)
Called when a new program is selected and/or unselected.
Definition vlc_player.h:2975
void(* on_titles_changed)(vlc_player_t *player, vlc_player_title_list *titles, void *data)
Called when the media titles has changed.
Definition vlc_player.h:2992
void(* on_cork_changed)(vlc_player_t *player, unsigned cork_count, void *data)
Called when the player is corked.
Definition vlc_player.h:3252
void(* on_track_list_changed)(vlc_player_t *player, enum vlc_player_list_action action, const struct vlc_player_track *track, void *data)
Called when a track is added, removed, or updated.
Definition vlc_player.h:2919
void(* on_teletext_enabled_changed)(vlc_player_t *player, bool enabled, void *data)
Called when teletext is enabled or disabled.
Definition vlc_player.h:3050
void(* on_playback_restore_queried)(vlc_player_t *player, void *data)
Called to query the user about restoring the previous playback position.
Definition vlc_player.h:3269
void(* on_track_delay_changed)(vlc_player_t *player, vlc_es_id_t *es_id, vlc_tick_t delay, void *data)
Called when a track delay has changed.
Definition vlc_player.h:2945
void(* on_chapter_selection_changed)(vlc_player_t *player, const struct vlc_player_title *title, size_t title_idx, const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx, void *data)
Called when a new chapter is selected.
Definition vlc_player.h:3026
void(* on_atobloop_changed)(vlc_player_t *player, enum vlc_player_abloop new_state, vlc_tick_t time, double pos, void *data)
Called when the A to B loop has changed.
Definition vlc_player.h:3162
void(* on_state_changed)(vlc_player_t *player, enum vlc_player_state new_state, void *data)
Called when the player state has changed.
Definition vlc_player.h:2823
void(* on_position_changed)(vlc_player_t *player, vlc_tick_t new_time, double new_pos, void *data)
Called when the player position has changed.
Definition vlc_player.h:2890
void(* on_buffering_changed)(vlc_player_t *player, float new_buffering, void *data)
Called when the player buffering (or cache) has changed.
Definition vlc_player.h:2850
void(* on_error_changed)(vlc_player_t *player, enum vlc_player_error error, void *data)
Called when a media triggered an error.
Definition vlc_player.h:2837
void(* on_renderer_changed)(vlc_player_t *player, vlc_renderer_item_t *new_item, void *data)
Called when a new renderer item is set.
Definition vlc_player.h:3111
void(* on_teletext_transparency_changed)(vlc_player_t *player, bool enabled, void *data)
Called when the teletext transparency has changed.
Definition vlc_player.h:3074
void(* on_rate_changed)(vlc_player_t *player, float new_rate, void *data)
Called when the player rate has changed.
Definition vlc_player.h:2863
void(* on_media_attachments_added)(vlc_player_t *player, input_item_t *media, input_attachment_t *const *array, size_t count, void *data)
Called when new attachments are added to the media.
Definition vlc_player.h:3211
Player chapter structure.
Definition vlc_player.h:953
const char * name
Chapter name, always valid.
Definition vlc_player.h:955
vlc_tick_t time
Position of this chapter.
Definition vlc_player.h:957
Definition player.h:132
Definition player.h:139
Player program structure.
Definition vlc_player.h:1188
bool selected
True if the program is selected.
Definition vlc_player.h:1194
const char * name
Program name, always valid.
Definition vlc_player.h:1192
int group_id
Id used for vlc_player_SelectProgram()
Definition vlc_player.h:1190
bool scrambled
True if the program is scrambled.
Definition vlc_player.h:1196
Definition player.h:236
vlc_cond_t notify
Definition player.h:284
bool start_paused
Definition player.h:244
input_item_t * media
Definition player.h:257
Player timer callbacks.
Definition vlc_player.h:3378
void(* on_seek)(const struct vlc_player_timer_point *value, void *data)
Called when the player is seeking or finished seeking (can be NULL).
Definition vlc_player.h:3433
void(* on_update)(const struct vlc_player_timer_point *value, void *data)
Called when the state or the time changed (mandatory).
Definition vlc_player.h:3397
void(* on_paused)(vlc_tick_t system_date, void *data)
The player timer is paused (can be NULL).
Definition vlc_player.h:3418
Definition player.h:173
Player timer point.
Definition vlc_player.h:3333
double position
Position in the range [0.0f;1.0].
Definition vlc_player.h:3335
vlc_tick_t system_date
System date of this record (always valid), this date can be in the future or in the past.
Definition vlc_player.h:3348
double rate
Rate of the player.
Definition vlc_player.h:3337
vlc_tick_t length
Valid length >= VLC_TICK_0 or VLC_TICK_INVALID.
Definition vlc_player.h:3342
vlc_tick_t ts
Valid time >= VLC_TICK_0 or VLC_TICK_INVALID, subtract this time with VLC_TICK_0 to get the original ...
Definition vlc_player.h:3340
Player smpte timer callbacks.
Definition vlc_player.h:3442
void(* on_update)(const struct vlc_player_timer_smpte_timecode *tc, void *data)
Called when a new frame is displayed.
Definition vlc_player.h:3453
Player smpte timecode.
Definition vlc_player.h:3357
unsigned seconds
Seconds [0;59].
Definition vlc_player.h:3363
unsigned minutes
Minutes [0;59].
Definition vlc_player.h:3361
unsigned hours
Hours [0;n].
Definition vlc_player.h:3359
bool drop_frame
True if the source is NTSC 29.97fps or 59.94fps DF.
Definition vlc_player.h:3369
unsigned frame_resolution
Maximum number of digits needed to display the frame number.
Definition vlc_player.h:3367
unsigned frames
Frame number [0;n].
Definition vlc_player.h:3365
Definition player.h:50
Player title structure.
Definition vlc_player.h:969
const struct vlc_player_chapter * chapters
Array of chapters, can be NULL.
Definition vlc_player.h:980
size_t chapter_count
Number of chapters, can be 0.
Definition vlc_player.h:978
vlc_tick_t length
Length of the title.
Definition vlc_player.h:973
unsigned flags
Bit flag of VLC_PLAYER_TITLE_MENU and VLC_PLAYER_TITLE_INTERACTIVE.
Definition vlc_player.h:976
const char * name
Title name, always valid.
Definition vlc_player.h:971
Player track structure.
Definition vlc_player.h:1348
bool selected
True if the track is selected.
Definition vlc_player.h:1356
es_format_t fmt
Es format.
Definition vlc_player.h:1354
const char * name
Track name, always valid.
Definition vlc_player.h:1352
vlc_es_id_t * es_id
Id used for any player actions, like vlc_player_SelectEsId()
Definition vlc_player.h:1350
Player vout callbacks.
Definition vlc_player.h:2563
void(* on_wallpaper_mode_changed)(vout_thread_t *vout, bool enabled, void *data)
Called when the player and/or vout wallpaper mode has changed.
Definition vlc_player.h:2585
void(* on_fullscreen_changed)(vout_thread_t *vout, bool enabled, void *data)
Called when the player and/or vout fullscreen state has changed.
Definition vlc_player.h:2573
Definition player.h:152
Definition renderer_discovery.c:36
Viewpoints.
Definition vlc_viewpoint.h:41
Video output thread descriptor.
Definition vlc_vout.h:54
Player metadata callbacks.
Definition vlc_player.h:2246
void(* on_loudness_changed)(vlc_tick_t date, const struct vlc_audio_loudness *loudness, void *data)
Called when loudness measurements have changed.
Definition vlc_player.h:2277
void(* on_momentary_loudness_changed)(vlc_tick_t date, double momentary_loudness, void *data)
Called when the momentary loudness measurement have changed.
Definition vlc_player.h:2260
Audio output modules interface.
This file is a collection of common definitions and types.
es_format_category_e
ES Categories.
Definition vlc_es.h:597
@ SPU_ES
Definition vlc_es.h:601
@ AUDIO_ES
Definition vlc_es.h:600
@ VIDEO_ES
Definition vlc_es.h:599
Input thread interface.
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48