VLC 4.0.0-dev
Loading...
Searching...
No Matches
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 * Get the A to B loop status
772 *
773 * @note If the returned status is VLC_PLAYER_ABLOOP_A, then a_time and a_pos
774 * will be valid. If the returned status is VLC_PLAYER_ABLOOP_B, then all
775 * output parameters are valid. If the returned status is
776 * VLC_PLAYER_ABLOOP_NONE, then all output parameters are invalid.
777 *
778 * @see vlc_player_cbs.on_atobloop_changed
779 *
780 * @param player locked player instance
781 * @param a_time A time or VLC_TICK_INVALID (if the media doesn't have valid
782 * times)
783 * @param a_pos A position
784 * @param b_time B time or VLC_TICK_INVALID (if the media doesn't have valid
785 * times)
786 * @param b_pos B position
787 * @return A to B loop status
788 */
790vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos,
791 vlc_tick_t *b_time, float *b_pos);
792
793/**
794 * Navigate (for DVD/Bluray menus or viewpoint)
795 *
796 * @param player locked player instance
797 * @param nav navigation key
798 */
799VLC_API void
801
802/**
803 * Update the viewpoint
804 *
805 * @param player locked player instance
806 * @param viewpoint the viewpoint value
807 * @param whence absolute or relative
808 */
809VLC_API void
811 const vlc_viewpoint_t *viewpoint,
812 enum vlc_player_whence whence);
813
814/**
815 * Check if the playing is recording
816 *
817 * @see vlc_player_cbs.on_recording_changed
818 *
819 * @param player locked player instance
820 * @return true if the player is recording
821 */
822VLC_API bool
824
825/**
826 * Enable or disable recording for the current media
827 *
828 * @note A successful call will trigger the vlc_player_cbs.on_recording_changed
829 * event.
830 *
831 * @param player locked player instance
832 * @param enabled true to enable recording
833 * @param dir_path path of the recording directory or NULL (use default path),
834 * has only an effect when first enabling recording.
835 */
836VLC_API void
837vlc_player_SetRecordingEnabled(vlc_player_t *player, bool enabled,
838 const char *dir_path);
839
840/**
841 * Helper to toggle the recording state
842 */
843static inline void
847}
848
849/**
850 * Add an associated (or external) media to the current media
851 *
852 * @param player locked player instance
853 * @param cat SPU_ES or UNKNOWN_ES
854 * @param uri absolute uri of the external media
855 * @param select true to select the track of this external media
856 * @param notify true to notify the OSD
857 * @param check_ext true to check subtitles extension
858 */
859VLC_API int
861 enum es_format_category_e cat, const char *uri,
862 bool select, bool notify, bool check_ext);
863
864/**
865 * Get the signal quality and strength of the current media
866 *
867 * @param player locked player instance
868 * @param quality a pointer that will be assigned with the signal quality
869 * @param strength a pointer that will be assigned with the signal strength
870 * @retval VLC_SUCCESS when quality and strength have been assigned
871 * @retval VLC_EGENERIC in case of error (strength and quality are not assigned)
872 */
873VLC_API int
874vlc_player_GetSignal(vlc_player_t *player, float *quality, float *strength);
875
876/**
877 * Get the statistics of the current media
878 *
879 * @warning The returned pointer becomes invalid when the player is unlocked.
880 * The referenced structure can be safely copied.
881 *
882 * @see vlc_player_cbs.on_statistics_changed
883 *
884 * @param player locked player instance
885 * @return pointer to the player stats structure or NULL
886 */
887VLC_API const struct input_stats_t *
889
890/**
891 * Restore the previous playback position of the current media
892 */
893VLC_API void
895
896/**
897 * Get the V4L2 object used to do controls
898 *
899 * @param player locked player instance
900 * @return the V4L2 object or NULL if not any. This object must be used with
901 * the player lock held.
902 */
905
906/** @} vlc_player__playback */
907
908/**
909 * @defgroup vlc_player__titles Title and chapter control
910 * @{
911 */
912
913/**
914 * Player chapter structure
915 */
918 /** Chapter name, always valid */
919 const char *name;
920 /** Position of this chapter */
923
924/** vlc_player_title.flags: The title is a menu. */
925#define VLC_PLAYER_TITLE_MENU 0x01
926/** vlc_player_title.flags: The title is interactive. */
927#define VLC_PLAYER_TITLE_INTERACTIVE 0x02
928/** vlc_player_title.flags: The title is the main one. */
929#define VLC_PLAYER_TITLE_MAIN 0x04
931/** Player title structure */
932struct vlc_player_title
934 /** Title name, always valid */
935 const char *name;
936 /** Length of the title */
938 /** Bit flag of @ref VLC_PLAYER_TITLE_MENU and @ref
939 * VLC_PLAYER_TITLE_INTERACTIVE */
940 unsigned flags;
941 /** Number of chapters, can be 0 */
942 size_t chapter_count;
943 /** Array of chapters, can be NULL */
944 const struct vlc_player_chapter *chapters;
946
947/**
948 * Opaque structure representing a list of @ref vlc_player_title.
949 *
950 * @see vlc_player_GetTitleList()
951 * @see vlc_player_title_list_GetCount()
952 * @see vlc_player_title_list_GetAt()
953 */
956/**
957 * Hold the title list of the player
958 *
959 * This function can be used to pass this title list from a callback to an
960 * other thread.
961 *
962 * @see vlc_player_cbs.on_titles_changed
963 *
964 * @return the same instance
965 */
968
969/**
970 * Release of previously held title list
971 */
972VLC_API void
974
975/**
976 * Get the number of title of a list
977 */
978VLC_API size_t
980
981/**
982 * Get the title at a given index
983 *
984 * @param titles a valid title list
985 * @param idx index in the range [0; count[
986 * @return a valid title (can't be NULL)
987 */
988VLC_API const struct vlc_player_title *
990
991/**
992 * Get the title list of the current media
993 *
994 * @see vlc_player_cbs.on_titles_changed
995 *
996 * @param player locked player instance
997 */
1000
1001/**
1002 * Get the selected title index for the current media
1003 *
1004 * @see vlc_player_cbs.on_title_selection_changed
1005 *
1006 * @param player locked player instance
1007 */
1008VLC_API ssize_t
1010
1011/**
1012 * Helper to get the current selected title
1013 */
1014static inline const struct vlc_player_title *
1018 if (!titles)
1019 return NULL;
1020 ssize_t selected_idx = vlc_player_GetSelectedTitleIdx(player);
1021 if (selected_idx < 0)
1022 return NULL;
1023 return vlc_player_title_list_GetAt(titles, selected_idx);
1024}
1025
1026/**
1027 * Select a title index for the current media
1028 *
1029 * @note A successful call will trigger the
1030 * vlc_player_cbs.on_title_selection_changed event.
1031 *
1032 * @see vlc_player_title_list_GetAt()
1033 * @see vlc_player_title_list_GetCount()
1034 *
1035 * @param player locked player instance
1036 * @param index valid index in the range [0;count[
1037 */
1038VLC_API void
1039vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index);
1040
1041/**
1042 * Select a title for the current media
1043 *
1044 * @note A successful call will trigger the
1045 * vlc_player_cbs.on_title_selection_changed event.
1046 *
1047 * @see vlc_player_title_list_GetAt()
1048 * @see vlc_player_title_list_GetCount()
1049 *
1050 * @param player locked player instance
1051 * @param title a valid title coming from the vlc_player_title_list
1052 */
1053VLC_API void
1055 const struct vlc_player_title *title);
1056
1057/**
1058 * Select a chapter for the current media
1059 *
1060 * @note A successful call will trigger the
1061 * vlc_player_cbs.on_chapter_selection_changed event.
1062 *
1063 * @param player locked player instance
1064 * @param title the selected title
1065 * @param chapter_idx index from vlc_player_title.chapters
1066 */
1067VLC_API void
1069 const struct vlc_player_title *title,
1070 size_t chapter_idx);
1071
1072/**
1073 * Select the next title for the current media
1074 *
1075 * @see vlc_player_SelectTitleIdx()
1076 */
1077VLC_API void
1079
1080/**
1081 * Select the previous title for the current media
1082 *
1083 * @see vlc_player_SelectTitleIdx()
1084 */
1085VLC_API void
1087
1088/**
1089 * Get the selected chapter index for the current media
1090 *
1091 * @see vlc_player_cbs.on_chapter_selection_changed
1092 *
1093 * @param player locked player instance
1094 */
1095VLC_API ssize_t
1097
1098/**
1099 * Helper to get the current selected chapter
1100 */
1101static inline const struct vlc_player_chapter *
1104 const struct vlc_player_title *title = vlc_player_GetSelectedTitle(player);
1105 if (!title || !title->chapter_count)
1106 return NULL;
1107 ssize_t chapter_idx = vlc_player_GetSelectedChapterIdx(player);
1108 return chapter_idx >= 0 ? &title->chapters[chapter_idx] : NULL;
1109}
1110
1111/**
1112 * Select a chapter index for the current media
1113 *
1114 * @note A successful call will trigger the
1115 * vlc_player_cbs.on_chapter_selection_changed event.
1116 *
1117 * @see vlc_player_title.chapters
1118 *
1119 * @param player locked player instance
1120 * @param index valid index in the range [0;vlc_player_title.chapter_count[
1121 */
1122VLC_API void
1123vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index);
1124
1125/**
1126 * Select the next chapter for the current media
1127 *
1128 * @see vlc_player_SelectChapterIdx()
1129 */
1130VLC_API void
1132
1133/**
1134 * Select the previous chapter for the current media
1135 *
1136 * @see vlc_player_SelectChapterIdx()
1137 */
1138VLC_API void
1140
1141/** @} vlc_player__titles */
1142
1143/**
1144 * @defgroup vlc_player__programs Program control
1145 * @{
1146 */
1147
1148/**
1149 * Player program structure.
1150 */
1151struct vlc_player_program
1153 /** Id used for vlc_player_SelectProgram() */
1154 int group_id;
1155 /** Program name, always valid */
1156 const char *name;
1157 /** True if the program is selected */
1158 bool selected;
1159 /** True if the program is scrambled */
1160 bool scrambled;
1162
1163/**
1164 * Duplicate a program
1165 *
1166 * This function can be used to pass a program from a callback to an other
1167 * context.
1168 *
1169 * @see vlc_player_cbs.on_program_list_changed
1170 *
1171 * @return a duplicated program or NULL on allocation error
1172 */
1174vlc_player_program_Dup(const struct vlc_player_program *prgm);
1175
1176/**
1177 * Delete a duplicated program
1178 */
1179VLC_API void
1181
1182/**
1183 * Get the number of programs
1184 *
1185 * @warning The returned size becomes invalid when the player is unlocked.
1186 *
1187 * @param player locked player instance
1188 * @return number of programs, or 0 (in case of error, or if the media is not
1189 * started)
1190 */
1191VLC_API size_t
1193
1194/**
1195 * Get the program at a specific index
1196 *
1197 * @warning The behaviour is undefined if the index is not valid.
1198 *
1199 * @warning The returned pointer becomes invalid when the player is unlocked.
1200 * The referenced structure can be safely copied with vlc_player_program_Dup().
1201 *
1202 * @param player locked player instance
1203 * @param index valid index in the range [0; count[
1204 * @return a valid program (can't be NULL if vlc_player_GetProgramCount()
1205 * returned a valid count)
1206 */
1207VLC_API const struct vlc_player_program *
1208vlc_player_GetProgramAt(vlc_player_t *player, size_t index);
1209
1210/**
1211 * Get a program from an ES group identifier
1212 *
1213 * @param player locked player instance
1214 * @param group_id a program ID (retrieved from
1215 * vlc_player_cbs.on_program_list_changed or vlc_player_GetProgramAt())
1216 * @return a valid program or NULL (if the program was terminated by the
1217 * playback thread)
1218 */
1219VLC_API const struct vlc_player_program *
1221
1222/**
1223 * Select a program from an ES group identifier
1224 *
1225 * This function can be used to pre-select a program by its id before starting
1226 * the player. It has only effect for the current media. It can also be used
1227 * when the player is already started.
1228 *
1229 * @note Selecting a non-existing program will cause the player to no select
1230 * any programs. Therefore, all tracks will be disabled.
1231 *
1232 * @param player locked player instance
1233 * @param group_id a program ID (retrieved from
1234 * vlc_player_cbs.on_program_list_changed or vlc_player_GetProgramAt())
1235 */
1236VLC_API void
1238
1239/**
1240 * Select the next program
1241 *
1242 * @param player locked player instance
1243 */
1244VLC_API void
1246
1247/**
1248 * Select the previous program
1249 *
1250 * @param player locked player instance
1251 */
1252VLC_API void
1254
1255/**
1256 * Helper to get the current selected program
1257 */
1258static inline const struct vlc_player_program *
1261 size_t count = vlc_player_GetProgramCount(player);
1262 for (size_t i = 0; i < count; ++i)
1263 {
1264 const struct vlc_player_program *program =
1265 vlc_player_GetProgramAt(player, i);
1266 assert(program);
1267 if (program->selected)
1268 return program;
1269 }
1270 return NULL;
1271}
1272
1273/** @} vlc_player__programs */
1274
1275/**
1276 * @defgroup vlc_player__tracks Tracks control
1277 * @{
1278 */
1279
1280/**
1281 * Player selection policy
1282 *
1283 * @see vlc_player_SelectEsId()
1284 */
1287 /**
1288 * Only one track per category is selected. Selecting a track with this
1289 * policy will disable all other tracks for the same category.
1290 */
1292 /**
1293 * Select multiple tracks for one category.
1294 *
1295 * Only one audio track can be selected at a time.
1296 * Two subtitle tracks can be selected simultaneously.
1297 * Multiple video tracks can be selected simultaneously.
1298 */
1301
1302/**
1303 * Player track structure.
1304 *
1305 * A track is a representation of an ES identifier at a given time. Once the
1306 * player is unlocked, all content except the es_id pointer can be updated.
1307 *
1308 * @see vlc_player_cbs.on_track_list_changed
1309 * @see vlc_player_GetTrack
1310 */
1311struct vlc_player_track
1313 /** Id used for any player actions, like vlc_player_SelectEsId() */
1315 /** Track name, always valid */
1316 const char *name;
1317 /** Es format */
1319 /** True if the track is selected */
1320 bool selected;
1322
1323/**
1324 * Duplicate a track
1325 *
1326 * This function can be used to pass a track from a callback to an other
1327 * context. The es_id will be held by the duplicated track.
1328 *
1329 * @warning The returned track won't be updated if the original one is modified
1330 * by the player.
1331 *
1332 * @see vlc_player_cbs.on_track_list_changed
1333 *
1334 * @return a duplicated track or NULL on allocation error
1335 */
1337vlc_player_track_Dup(const struct vlc_player_track *track);
1338
1339/**
1340 * Delete a duplicated track
1341 */
1342VLC_API void
1344
1345/**
1346 * Get the number of tracks for an ES category
1347 *
1348 * @warning The returned size becomes invalid when the player is unlocked.
1349 *
1350 * @param player locked player instance
1351 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1352 * @return number of tracks, or 0 (in case of error, or if the media is not
1353 * started)
1354 */
1355VLC_API size_t
1357
1358/**
1359 * Get the track at a specific index for an ES category
1360 *
1361 * @warning The behaviour is undefined if the index is not valid.
1362 *
1363 * @warning The returned pointer becomes invalid when the player is unlocked.
1364 * The referenced structure can be safely copied with vlc_player_track_Dup().
1365 *
1366 * @param player locked player instance
1367 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1368 * @param index valid index in the range [0; count[
1369 * @return a valid track (can't be NULL if vlc_player_GetTrackCount() returned
1370 * a valid count)
1371 */
1372VLC_API const struct vlc_player_track *
1374 size_t index);
1375
1376/**
1377 * Helper to get the video track count
1378 */
1379static inline size_t
1382 return vlc_player_GetTrackCount(player, VIDEO_ES);
1383}
1384
1385/**
1386 * Helper to get a video track at a specific index
1387 */
1388static inline const struct vlc_player_track *
1389vlc_player_GetVideoTrackAt(vlc_player_t *player, size_t index)
1391 return vlc_player_GetTrackAt(player, VIDEO_ES, index);
1392}
1393
1394/**
1395 * Helper to get the audio track count
1396 */
1397static inline size_t
1400 return vlc_player_GetTrackCount(player, AUDIO_ES);
1401}
1402
1403/**
1404 * Helper to get an audio track at a specific index
1405 */
1406static inline const struct vlc_player_track *
1407vlc_player_GetAudioTrackAt(vlc_player_t *player, size_t index)
1409 return vlc_player_GetTrackAt(player, AUDIO_ES, index);
1410}
1411
1412/**
1413 * Helper to get the subtitle track count
1414 */
1415static inline size_t
1418 return vlc_player_GetTrackCount(player, SPU_ES);
1419}
1420
1421/**
1422 * Helper to get a subtitle track at a specific index
1423 */
1424static inline const struct vlc_player_track *
1425vlc_player_GetSubtitleTrackAt(vlc_player_t *player, size_t index)
1427 return vlc_player_GetTrackAt(player, SPU_ES, index);
1428}
1429
1430/**
1431 * Get a track from an ES identifier
1432 *
1433 * @warning The returned pointer becomes invalid when the player is unlocked.
1434 * The referenced structure can be safely copied with vlc_player_track_Dup().
1435 *
1436 * @param player locked player instance
1437 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1438 * vlc_player_GetTrackAt())
1439 * @return a valid player track or NULL (if the track was terminated by the
1440 * playback thread)
1441 */
1442VLC_API const struct vlc_player_track *
1444
1445/**
1446 * Get and the video output used by a ES identifier
1447 *
1448 * @warning A same vout can be associated with multiple ES during the lifetime
1449 * of the player. The information returned by this function becomes invalid
1450 * when the player is unlocked. The returned vout doesn't need to be released,
1451 * but must be held with vout_Hold() if it is accessed after the player is
1452 * unlocked.
1453 *
1454 * @param player locked player instance
1455 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1456 * vlc_player_GetTrackAt())
1457 * @param order if not null, the order of the vout
1458 * @return a valid vout or NULL (if the track is disabled, it it's not a video
1459 * or spu track, or if the vout failed to start)
1460 */
1463 enum vlc_vout_order *order);
1464
1465/**
1466 * Get the ES identifier of a video output
1467 *
1468 * @warning A same vout can be associated with multiple ES during the lifetime
1469 * of the player. The information returned by this function becomes invalid
1470 * when the player is unlocked. The returned es_id doesn't need to be released,
1471 * but must be held with vlc_es_id_Hold() if it accessed after the player is
1472 * unlocked.
1473 *
1474 * @param player locked player instance
1475 * @param vout vout (can't be NULL)
1476 * @return a valid ES identifier or NULL (if the vout is stopped)
1477 */
1480
1481/**
1482 * Helper to get the selected track from an ES category
1483 *
1484 * @warning The player can have more than one selected track for a same ES
1485 * category. This function will only return the first selected one. Use
1486 * vlc_player_GetTrackAt() and vlc_player_GetTrackCount() to iterate through
1487 * several selected tracks.
1488 */
1489static inline const struct vlc_player_track *
1492 size_t count = vlc_player_GetTrackCount(player, cat);
1493 for (size_t i = 0; i < count; ++i)
1494 {
1495 const struct vlc_player_track *track =
1496 vlc_player_GetTrackAt(player, cat, i);
1497 assert(track);
1498 if (track->selected)
1499 return track;
1500 }
1501 return NULL;
1502}
1503
1504/**
1505 * Select tracks by their string identifier
1506 *
1507 * This function can be used to pre-select a list of tracks before starting the
1508 * player. It has only effect for the current media. It can also be used when
1509 * the player is already started.
1510
1511 * 'str_ids' can contain more than one track id, delimited with ','. "" or any
1512 * invalid track id will cause the player to unselect all tracks of that
1513 * category. NULL will disable the preference for newer tracks without
1514 * unselecting any current tracks.
1515 *
1516 * Example:
1517 * - (VIDEO_ES, "video/1,video/2") will select these 2 video tracks. If there
1518 * is only one video track with the id "video/0", no tracks will be selected.
1519 * - (SPU_ES, "${slave_url_md5sum}/spu/0) will select one spu added by an input
1520 * slave with the corresponding url.
1521 *
1522 * @note The string identifier of a track can be found via vlc_es_id_GetStrId().
1523 *
1524 * @param player locked player instance
1525 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1526 * @param str_ids list of string identifier or NULL
1527 */
1528VLC_API void
1530 enum es_format_category_e cat,
1531 const char *str_ids);
1532
1533/**
1534 * Select a track from an ES identifier
1535 *
1536 * @note A successful call will trigger the
1537 * vlc_player_cbs.on_track_selection_changed event.
1538 *
1539 * @param player locked player instance
1540 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1541 * vlc_player_GetTrackAt())
1542 * @param policy exclusive or simultaneous
1543 * @return the number of track selected for es_id category
1544 */
1545VLC_API unsigned
1547 enum vlc_player_select_policy policy);
1548
1549
1550/**
1551 * Helper to select a track
1552 */
1553static inline unsigned
1555 const struct vlc_player_track *track,
1556 enum vlc_player_select_policy policy)
1557{
1558 return vlc_player_SelectEsId(player, track->es_id, policy);
1559}
1560
1561/**
1562 * Select multiple tracks from a list of ES identifiers.
1563 *
1564 * Any tracks of the category, not referenced in the list will be unselected.
1565 *
1566 * @warning there is no guarantee all requested tracks will be selected. The
1567 * behaviour is undefined if the list is not null-terminated.
1568 *
1569 * @note A successful call will trigger the
1570 * vlc_player_cbs.on_track_selection_changed event for each track that has
1571 * its selection state changed.
1572 *
1573 * @see VLC_PLAYER_SELECT_SIMULTANEOUS
1574 *
1575 * @param player locked player instance
1576 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1577 * @param es_id_list a null-terminated list of ES identifiers. es_ids not
1578 * corresponding to the category will be ignored.
1579 * (ES IDs can be retrieved from vlc_player_cbs.on_track_list_changed or
1580 * vlc_player_GetTrackAt())
1581 * @return the number of track selected for that category
1582 */
1583VLC_API unsigned
1585 enum es_format_category_e cat,
1586 vlc_es_id_t *const es_id_list[]);
1587
1588/**
1589 * Select the next track
1590 *
1591 * If the last track is already selected, a call to this function will disable
1592 * this last track. And a second call will select the first track.
1593 *
1594 * @warning This function has no effects if there are several tracks selected
1595 * for a same category. Therefore the default policy is
1596 * VLC_PLAYER_SELECT_EXCLUSIVE.
1597 *
1598 * @param player locked player instance
1599 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1600 */
1601VLC_API void
1603 enum es_format_category_e cat);
1604
1605/**
1606 * Select the Previous track
1607 *
1608 * If the first track is already selected, a call to this function will disable
1609 * this first track. And a second call will select the last track.
1610 *
1611 * @warning This function has no effects if there are several tracks selected
1612 * for a same category. Therefore the default policy is
1613 * VLC_PLAYER_SELECT_EXCLUSIVE.
1614 *
1615 * @param player locked player instance
1616 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1617 */
1618VLC_API void
1620 enum es_format_category_e cat);
1621
1622/**
1623 * Unselect a track from an ES identifier
1624 *
1625 * @warning Other tracks of the same category won't be touched.
1626 *
1627 * @note A successful call will trigger the
1628 * vlc_player_cbs.on_track_selection_changed event.
1629 *
1630 * @param player locked player instance
1631 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1632 * vlc_player_GetTrackAt())
1633 */
1634VLC_API void
1636
1637/**
1638 * Helper to unselect a track
1639 */
1640static inline void
1642 const struct vlc_player_track *track)
1643{
1644 vlc_player_UnselectEsId(player, track->es_id);
1645}
1646
1647/**
1648 * Helper to unselect all tracks from an ES category
1649 */
1650static inline void
1653{
1654 size_t count = vlc_player_GetTrackCount(player, cat);
1655 for (size_t i = 0; i < count; ++i)
1656 {
1657 const struct vlc_player_track *track =
1658 vlc_player_GetTrackAt(player, cat, i);
1659 assert(track);
1660 if (track->selected)
1661 vlc_player_UnselectTrack(player, track);
1662 }
1663}
1664
1665/**
1666 * Restart a track from an ES identifier
1667 *
1668 * @note A successful call will trigger the
1669 * vlc_player_cbs.on_track_selection_changed event.
1670 *
1671 * @param player locked player instance
1672 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1673 * vlc_player_GetTrackAt())
1674 */
1675VLC_API void
1677
1678/**
1679 * Helper to restart a track
1680 */
1681static inline void
1683 const struct vlc_player_track *track)
1684{
1685 vlc_player_RestartEsId(player, track->es_id);
1686}
1687
1688/**
1689 * Helper to restart all selected tracks from an ES category
1690 */
1691static inline void
1694{
1695 size_t count = vlc_player_GetTrackCount(player, cat);
1696 for (size_t i = 0; i < count; ++i)
1697 {
1698 const struct vlc_player_track *track =
1699 vlc_player_GetTrackAt(player, cat, i);
1700 assert(track);
1701 if (track->selected)
1702 vlc_player_RestartTrack(player, track);
1703 }
1704}
1705
1706/**
1707 * Select the language for an ES category
1708 *
1709 * @warning The language will only be set for all future played media.
1710 *
1711 * @param player locked player instance
1712 * @param cat AUDIO_ES or SPU_ES
1713 * @param lang comma separated, two or three letters country code, 'any' as a
1714 * fallback or NULL to reset the default state
1715 */
1716VLC_API void
1718 enum es_format_category_e cat,
1719 const char *lang);
1720
1721/**
1722 * Get the language of an ES category
1723 *
1724 * @warning This only reflects the change made by
1725 * vlc_player_SelectCategoryLanguage(). The current playing track doesn't
1726 * necessarily correspond to the returned language.
1727 *
1728 * @see vlc_player_SelectCategoryLanguage
1729 *
1730 * @param player locked player instance
1731 * @param cat AUDIO_ES or SPU_ES
1732 * @return valid language or NULL, need to be freed
1733 */
1734VLC_API char *
1736 enum es_format_category_e cat);
1737
1738/**
1739 * Helper to select the audio language
1740 */
1741static inline void
1742vlc_player_SelectAudioLanguage(vlc_player_t *player, const char *lang)
1745}
1746
1747/**
1748 * Helper to select the subtitle language
1749 */
1750static inline void
1751vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
1754}
1755
1756/**
1757 * Enable or disable a track category
1758 *
1759 * If a track category is disabled, the player won't select any tracks of this
1760 * category automatically or via an user action (vlc_player_SelectTrack()).
1761 *
1762 * @param player locked player instance
1763 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1764 * @param enabled true to enable
1765 */
1766VLC_API void
1768 enum es_format_category_e cat, bool enabled);
1769
1770/**
1771 * Check if a track category is enabled
1772 *
1773 * @param player locked player instance
1774 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1775 */
1776VLC_API bool
1778 enum es_format_category_e cat);
1779
1780/**
1781 * Helper to enable or disable video tracks
1782 */
1783static inline void
1784vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
1787}
1788
1789/**
1790 * Helper to check if video tracks are enabled
1791 */
1792static inline bool
1796}
1797
1798/**
1799 * Helper to enable or disable audio tracks
1800 */
1801static inline void
1802vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
1805}
1806
1807/**
1808 * Helper to check if audio tracks are enabled
1809 */
1810static inline bool
1814}
1815
1816/**
1817 * Helper to enable or disable subtitle tracks
1818 */
1819static inline void
1820vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
1823}
1824
1825/**
1826 * Helper to check if subtitle tracks are enabled
1827 */
1828static inline bool
1832}
1833
1834/**
1835 * Helper to toggle subtitles
1836 */
1837static inline void
1840 bool enabled = !vlc_player_IsSubtitleEnabled(player);
1841 vlc_player_SetSubtitleEnabled(player, enabled);
1842}
1843
1844/**
1845 * Set the subtitle text scaling factor
1846 *
1847 * @note This function have an effect only if the subtitle track is a text type.
1848 *
1849 * @param player locked player instance
1850 * @param scale factor in the range [10;500] (default: 100)
1851 */
1852VLC_API void
1853vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale);
1854
1855/**
1856 * Get the subtitle text scaling factor
1857 *
1858 * @param player locked player instance
1859 * @return scale factor
1860 */
1861VLC_API unsigned
1863
1864/** @} vlc_player__tracks */
1865
1866/**
1867 * @defgroup vlc_player__tracks_sync Tracks synchronisation (delay)
1868 * @{
1869 */
1870
1871/**
1872 * Get the delay of an ES category for the current media
1873 *
1874 * @see vlc_player_cbs.on_category_delay_changed
1875 *
1876 * @param player locked player instance
1877 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1878 * @return a valid delay or 0
1879 */
1882
1883/**
1884 * Set the delay of one category for the current media
1885 *
1886 * @note A successful call will trigger the
1887 * vlc_player_cbs.on_category_delay_changed event.
1888 *
1889 * @warning This has no effect on tracks where the delay was set by
1890 * vlc_player_SetEsIdDelay()
1891 *
1892 * @param player locked player instance
1893 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1894 * @param delay a valid time
1895 * @param whence absolute or relative
1896 * @return VLC_SUCCESS or VLC_EGENERIC if the category is not handled
1897 */
1898VLC_API int
1900 vlc_tick_t delay, enum vlc_player_whence whence);
1901
1902/**
1903 * Get the delay of a track
1904 *
1905 * @see vlc_player_cbs.on_track_delay_changed
1906 *
1907 * @param player locked player instance
1908 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1909 * vlc_player_GetTrackAt())
1910 * @return a valid delay or INT64_MAX is no delay is set for this track
1911 */
1914
1915/**
1916 * Set the delay of one track
1917 *
1918 * @note A successful call will trigger the
1919 * vlc_player_cbs.on_track_delay_changed event.
1920 *
1921 * @warning Setting the delay of one specific track will override previous and
1922 * future changes of delay made by vlc_player_SetCategoryDelay()
1923 *
1924 * @param player locked player instance
1925 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1926 * vlc_player_GetTrackAt())
1927 * @param delay a valid time or INT64_MAX to use default category delay
1928 * @param whence absolute or relative
1929 * @return VLC_SUCCESS or VLC_EGENERIC if the category of the es_id is not
1930 * handled (VIDEO_ES not supported yet)
1931 */
1932VLC_API int
1934 vlc_tick_t delay, enum vlc_player_whence whence);
1935
1936/**
1937 * Helper to get the audio delay
1938 */
1939static inline vlc_tick_t
1942 return vlc_player_GetCategoryDelay(player, AUDIO_ES);
1943}
1944
1945/**
1946 * Helper to set the audio delay
1947 */
1948static inline void
1951
1952{
1953 vlc_player_SetCategoryDelay(player, AUDIO_ES, delay, whence);
1954}
1955
1956/**
1957 * Helper to get the audio delay
1958 */
1959static inline vlc_tick_t
1962 return vlc_player_GetCategoryDelay(player, VIDEO_ES);
1963}
1964
1965/**
1966 * Helper to set the audio delay
1967 */
1968static inline void
1971
1972{
1973 vlc_player_SetCategoryDelay(player, VIDEO_ES, delay, whence);
1974}
1975
1976/**
1977 * Helper to get the subtitle delay
1978 */
1979static inline vlc_tick_t
1982 return vlc_player_GetCategoryDelay(player, SPU_ES);
1983}
1984
1985/**
1986 * Helper to set the subtitle delay
1987 */
1988static inline void
1991{
1992 vlc_player_SetCategoryDelay(player, SPU_ES, delay, whence);
1993}
1994
1995/**
1996 * Set the associated subtitle FPS
1997 *
1998 * In order to correct the rate of the associated media according to this FPS
1999 * and the media video FPS.
2000 *
2001 * @note A successful call will trigger the
2002 * vlc_player_cbs.on_associated_subs_fps_changed event.
2003 *
2004 * @warning this function will change the rate of all external subtitle files
2005 * associated with the current media.
2006 *
2007 * @param player locked player instance
2008 * @param fps FPS of the subtitle file
2009 */
2010VLC_API void
2012
2013/**
2014 * Get the associated subtitle FPS
2015 *
2016 * @param player locked player instance
2017 * @return fps
2018 */
2019VLC_API float
2021
2022/** @} vlc_player__tracks_sync */
2023
2024/**
2025 * @defgroup vlc_player__teletext Teletext control
2026 * @{
2027 */
2028
2029/**
2030 * Check if the media has a teletext menu
2031 *
2032 * @see vlc_player_cbs.on_teletext_menu_changed
2033 *
2034 * @param player locked player instance
2035 * @return true if the media has a teletext menu
2036 */
2037VLC_API bool
2039
2040/**
2041 * Enable or disable teletext
2042 *
2043 * This function has an effect only if the player has a teletext menu.
2044 *
2045 * @note A successful call will trigger the
2046 * vlc_player_cbs.on_teletext_enabled_changed event.
2047 *
2048 * @param player locked player instance
2049 * @param enabled true to enable
2050 */
2051VLC_API void
2052vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled);
2053
2054/**
2055 * Check if teletext is enabled
2056 *
2057 * @see vlc_player_cbs.on_teletext_enabled_changed
2058 *
2059 * @param player locked player instance
2060 */
2061VLC_API bool
2063
2064/**
2065 * Select a teletext page or do an action from a key
2066 *
2067 * This function has an effect only if the player has a teletext menu.
2068 *
2069 * @note Page keys can be the following: @ref VLC_PLAYER_TELETEXT_KEY_RED,
2070 * @ref VLC_PLAYER_TELETEXT_KEY_GREEN, @ref VLC_PLAYER_TELETEXT_KEY_YELLOW,
2071 * @ref VLC_PLAYER_TELETEXT_KEY_BLUE or @ref VLC_PLAYER_TELETEXT_KEY_INDEX.
2072
2073 * @note A successful call will trigger the
2074 * vlc_player_cbs.on_teletext_page_changed event.
2075 *
2076 * @param player locked player instance
2077 * @param page a page in the range ]0;888] or a valid key
2078 */
2079VLC_API void
2080vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page);
2081
2082/**
2083 * Get the current teletext page
2084 *
2085 * @see vlc_player_cbs.on_teletext_page_changed
2086 *
2087 * @param player locked player instance
2088 */
2089VLC_API unsigned
2091
2092/**
2093 * Enable or disable teletext transparency
2094 *
2095 * This function has an effect only if the player has a teletext menu.
2096
2097 * @note A successful call will trigger the
2098 * vlc_player_cbs.on_teletext_transparency_changed event.
2099 *
2100 * @param player locked player instance
2101 * @param enabled true to enable
2102 */
2103VLC_API void
2105
2106/**
2107 * Check if teletext is transparent
2108 *
2109 * @param player locked player instance
2110 */
2111VLC_API bool
2113
2114/** @} vlc_player__teletext */
2115
2116/**
2117 * @defgroup vlc_player__renderer External renderer control
2118 * @{
2119 */
2120
2121/**
2122 * Set the renderer
2123 *
2124 * Valid for the current media and all future ones.
2125 *
2126 * @note A successful call will trigger the vlc_player_cbs.on_renderer_changed
2127 * event.
2128 *
2129 * @param player locked player instance
2130 * @param renderer a valid renderer item or NULL (to disable it), the item will
2131 * be held by the player
2132 */
2133VLC_API void
2135
2136/**
2137 * Get the renderer
2138 *
2139 * @see vlc_player_cbs.on_renderer_changed
2140 *
2141 * @param player locked player instance
2142 * @return the renderer item set by vlc_player_SetRenderer()
2143 */
2146
2147/** @} vlc_player__renderer */
2148
2149/**
2150 * @defgroup vlc_player__metadata Metadata callbacks
2151 * @{
2152 */
2153
2154/**
2155 * Player metadata listener opaque structure.
2156 *
2157 * This opaque structure is returned by vlc_player_AddMetadataListener() and
2158 * can be used to remove the listener via
2159 * vlc_player_RemoveMetadataListener().
2160 */
2163/**
2164 * Player metadata option
2165 */
2168 /**
2169 * Ask for momentary loudness measurement
2170 *
2171 * Very low CPU usage.
2172 * @see vlc_player_metadata_cbs.on_momentary_loudness_changed
2173 */
2176 /**
2177 * Ask for all loudness measurements
2178 *
2179 * High CPU usage.
2180 * @see vlc_player_metadata_cbs.on_loudness_changed
2181 */
2184
2185/**
2186 * Player metadata callbacks
2187 *
2188 * Can be registered with vlc_player_AddMetadataListener().
2189 *
2190 * @warning To avoid deadlocks, users should never call vlc_player_t functions
2191 * from these callbacks.
2192 */
2195 /**
2196 * Called when the momentary loudness measurement have changed
2197 *
2198 * @see VLC_PLAYER_METADATA_LOUDNESS_MOMEMTARY
2199 *
2200 * Only sent when audio is playing, approximately every 400ms (but can be
2201 * higher, depending on the input sample size).
2202 *
2203 * @param date Absolute date of the measurement. It is most likely in the
2204 * future (0 to 2seconds) depending on the audio output buffer size.
2205 * @param momentary_loudness Momentary loudness
2206 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2207 */
2209 double momentary_loudness,
2210 void *data);
2211
2212 /**
2213 * Called when loudness measurements have changed
2214 *
2215 * @see VLC_PLAYER_METADATA_LOUDNESS_FULL
2216 *
2217 * Only sent when audio is playing, approximately every 400ms (but can be
2218 * higher, depending on the input sample size).
2219 *
2220 * @param date Absolute date of the measurement. It is most likely in the
2221 * future (0 to 2seconds) depending on the audio output buffer size.
2222 * @param loudness loudness measurement
2223 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2224 */
2225 void (*on_loudness_changed)(vlc_tick_t date,
2226 const struct vlc_audio_loudness *loudness,
2227 void *data);
2228};
2229
2230/**
2231 * Add a metadata listener
2232 *
2233 * @note Every registered loudness meter need to be removed by the caller with
2234 * vlc_player_RemoveMetadataListener().
2235 *
2236 * @param player locked player instance
2237 * @param option select which metadata to listen
2238 * @param cbs pointer to a vlc_player_metadata_cbs union, the
2239 * structure must be valid during the lifetime of the player
2240 * @param cbs_data opaque pointer used by the callbacks
2241 * @return a valid listener id, or NULL in case of error (plugin missing)
2242 */
2245 enum vlc_player_metadata_option option,
2246 const union vlc_player_metadata_cbs *cbs,
2247 void *cbs_data);
2248
2249/**
2250 * Remove a metadata listener
2251 *
2252 * @param player player instance
2253 * @param listener_id listener id returned by vlc_player_AddMetadataListener()
2254 */
2255VLC_API void
2257 vlc_player_metadata_listener_id *listener_id);
2258
2259
2260/** @} vlc_player__metadata */
2261
2262/**
2263 * @defgroup vlc_player__aout Audio output control
2264 * @{
2265 */
2266
2267/**
2268 * Player aout listener opaque structure.
2269 *
2270 * This opaque structure is returned by vlc_player_aout_AddListener() and can
2271 * be used to remove the listener via vlc_player_aout_RemoveListener().
2272 */
2275/**
2276 * Player aout callbacks
2277 *
2278 * Can be registered with vlc_player_aout_AddListener().
2279 *
2280 * @warning To avoid deadlocks, users should never call audio_output_t and
2281 * vlc_player_t functions from these callbacks.
2282 */
2285 /**
2286 * Called when the volume has changed
2287 *
2288 * @see vlc_player_aout_SetVolume()
2289 *
2290 * @param aout the main aout of the player
2291 * @param new_volume volume in the range [0;2.f]
2292 * @param data opaque pointer set by vlc_player_aout_AddListener()
2293 */
2294 void (*on_volume_changed)(audio_output_t *aout, float new_volume,
2295 void *data);
2296
2297 /**
2298 * Called when the mute state has changed
2299 *
2300 * @see vlc_player_aout_Mute()
2301 *
2302 * @param aout the main aout of the player
2303 * @param new_mute true if muted
2304 * @param data opaque pointer set by vlc_player_aout_AddListener()
2305 */
2306 void (*on_mute_changed)(audio_output_t *aout, bool new_muted,
2307 void *data);
2308
2309 /**
2310 * Called when the audio device has changed
2311 *
2312 * @param aout the main aout of the player
2313 * @param device the device name
2314 * @param data opaque pointer set by vlc_player_aout_AddListener()
2315 */
2316 void (*on_device_changed)(audio_output_t *aout, const char *device,
2317 void *data);
2318};
2319
2320/**
2321 * Get the audio output
2322 *
2323 * @warning The returned pointer must be released with aout_Release().
2324 *
2325 * @param player player instance
2326 * @return a valid audio_output_t * or NULL (if there is no aouts)
2327 */
2330
2331/**
2332 * Reset the main audio output
2333 *
2334 * @warning The main aout can only by reset if it is not currently used by any
2335 * decoders (before any play).
2336 *
2337 * @param player player instance
2338 */
2339VLC_API void
2341
2342/**
2343 * Add a listener callback for audio output events
2344 *
2345 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2346 * functions.
2347 * @note Every registered callbacks need to be removed by the caller with
2348 * vlc_player_aout_RemoveListener().
2349 *
2350 * @param player player instance
2351 * @param cbs pointer to a vlc_player_aout_cbs structure, the structure must be
2352 * valid during the lifetime of the player
2353 * @param cbs_data opaque pointer used by the callbacks
2354 * @return a valid listener id, or NULL in case of allocation error
2355 */
2358 const struct vlc_player_aout_cbs *cbs,
2359 void *cbs_data);
2360
2361/**
2362 * Remove a aout listener callback
2363 *
2364 * @param player player instance
2365 * @param listener_id listener id returned by vlc_player_aout_AddListener()
2366 */
2367VLC_API void
2369 vlc_player_aout_listener_id *listener_id);
2370
2371/**
2372 * Get the audio volume
2373 *
2374 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2375 * functions.
2376 *
2377 * @see vlc_player_aout_cbs.on_volume_changed
2378 *
2379 * @param player player instance
2380 * @return volume in the range [0;2.f] or -1.f if there is no audio outputs
2381 * (independent of mute)
2382 */
2383VLC_API float
2385
2386/**
2387 * Set the audio volume
2388 *
2389 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2390 * functions.
2391 *
2392 * @note A successful call will trigger the
2393 * vlc_player_vout_cbs.on_volume_changed event.
2394 *
2395 * @param player player instance
2396 * @param volume volume in the range [0;2.f]
2397 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2398 */
2399VLC_API int
2400vlc_player_aout_SetVolume(vlc_player_t *player, float volume);
2401
2402/**
2403 * Increment the audio volume
2404 *
2405 * @see vlc_player_aout_SetVolume()
2406 *
2407 * @param player player instance
2408 * @param steps number of "volume-step"
2409 * @param result pointer to store the resulting volume (can be NULL)
2410 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2411 */
2412VLC_API int
2413vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result);
2414
2415/**
2416 * Helper to decrement the audio volume
2417 */
2418static inline int
2419vlc_player_aout_DecrementVolume(vlc_player_t *player, int steps, float *result)
2421 return vlc_player_aout_IncrementVolume(player, -steps, result);
2422}
2423
2424/**
2425 * Check if the audio output is muted
2426 *
2427 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2428 * functions.
2429 *
2430 * @see vlc_player_aout_cbs.on_mute_changed
2431 *
2432 * @param player player instance
2433 * @return 0 if not muted, 1 if muted, -1 if there is no audio outputs
2434 */
2435VLC_API int
2437
2438/**
2439 * Mute or unmute the audio output
2440 *
2441 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2442 * functions.
2443 *
2444 * @note A successful call will trigger the
2445 * vlc_player_aout_cbs.on_mute_changed event.
2446 *
2447 * @param player player instance
2448 * @param mute true to mute
2449 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2450 */
2451VLC_API int
2452vlc_player_aout_Mute(vlc_player_t *player, bool mute);
2453
2454/**
2455 * Helper to toggle the mute state
2456 */
2457static inline int
2460 return vlc_player_aout_Mute(player,
2461 !vlc_player_aout_IsMuted(player));
2462}
2463
2464/**
2465 * Enable or disable an audio filter
2466 *
2467 * @see aout_EnableFilter()
2468 *
2469 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2470 */
2471VLC_API int
2472vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add);
2473
2474/** @} vlc_player__aout */
2475
2476/**
2477 * @defgroup vlc_player__vout Video output control
2478 * @{
2479 */
2480
2481/**
2482 * Player vout listener opaque structure.
2483 *
2484 * This opaque structure is returned by vlc_player_vout_AddListener() and can
2485 * be used to remove the listener via vlc_player_vout_RemoveListener().
2486 */
2489/**
2490 * action of vlc_player_cbs.on_vout_changed callback
2491 */
2498/**
2499 * Player vout callbacks
2500 *
2501 * Can be registered with vlc_player_vout_AddListener().
2502 *
2503 * @note The state changed from the callbacks can be either applied on the
2504 * player (and all future video outputs), or on a specified video output. The
2505 * state is applied on the player when the vout argument is NULL.
2506 *
2507 * @warning To avoid deadlocks, users should never call vout_thread_t and
2508 * vlc_player_t functions from these callbacks.
2509 */
2512 /**
2513 * Called when the player and/or vout fullscreen state has changed
2514 *
2515 * @see vlc_player_vout_SetFullscreen()
2516 *
2517 * @param vout cf. vlc_player_vout_cbs note
2518 * @param enabled true when fullscreen is enabled
2519 * @param data opaque pointer set by vlc_player_vout_AddListener()
2520 */
2521 void (*on_fullscreen_changed)(vout_thread_t *vout, bool enabled,
2522 void *data);
2523
2524 /**
2525 * Called when the player and/or vout wallpaper mode has changed
2526 *
2527 * @see vlc_player_vout_SetWallpaperModeEnabled()
2528 *
2529 * @param vout cf. vlc_player_vout_cbs note
2530 * @param enabled true when wallpaper mode is enabled
2531 * @param data opaque pointer set by vlc_player_vout_AddListener()
2532 */
2533 void (*on_wallpaper_mode_changed)(vout_thread_t *vout, bool enabled,
2534 void *data);
2535};
2536
2537
2538/**
2539 * Get and hold the main video output
2540 *
2541 * @warning the returned vout_thread_t * must be released with vout_Release().
2542 * @see vlc_players_cbs.on_vout_changed
2543 *
2544 * @note The player is guaranteed to always hold one valid vout. Only vout
2545 * variables can be changed from this instance. The vout returned before
2546 * playback is not necessarily the same one that will be used for playback.
2547 *
2548 * @param player player instance
2549 * @return a valid vout_thread_t * or NULL, cf. warning
2550 */
2553
2554/**
2555 * Get and hold the list of video output
2556 *
2557 * @warning All vout_thread_t * element of the array must be released with
2558 * vout_Release(). The returned array must be freed.
2559 *
2560 * @see vlc_players_cbs.on_vout_changed
2561 *
2562 * @param player player instance
2563 * @param count valid pointer to store the array count
2564 * @return a array of vout_thread_t * or NULL, cf. warning
2565 */
2568
2569/**
2570 * Add a listener callback for video output events
2571 *
2572 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2573 * functions.
2574 * @note Every registered callbacks need to be removed by the caller with
2575 * vlc_player_vout_RemoveListener().
2576 *
2577 * @param player player instance
2578 * @param cbs pointer to a vlc_player_vout_cbs structure, the structure must be
2579 * valid during the lifetime of the player
2580 * @param cbs_data opaque pointer used by the callbacks
2581 * @return a valid listener id, or NULL in case of allocation error
2582 */
2585 const struct vlc_player_vout_cbs *cbs,
2586 void *cbs_data);
2587
2588/**
2589 * Remove a vout listener callback
2590 *
2591 * @param player player instance
2592 * @param listener_id listener id returned by vlc_player_vout_AddListener()
2593 */
2594VLC_API void
2596 vlc_player_vout_listener_id *listener_id);
2597
2598/**
2599 * Check if the player is fullscreen
2600 *
2601 * @warning The fullscreen state of the player and all vouts can be different.
2602 *
2603 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2604 * functions.
2605 *
2606 * @see vlc_player_vout_cbs.on_fullscreen_changed
2607 *
2608 * @param player player instance
2609 * @return true if the player is fullscreen
2610 */
2611VLC_API bool
2613
2614/**
2615 * Enable or disable the player fullscreen state
2616 *
2617 * This will have an effect on all current and future vouts.
2618 *
2619 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2620 * functions.
2621 * @note A successful call will trigger the
2622 * vlc_player_vout_cbs.on_fullscreen_changed event.
2623 *
2624 * @param player player instance
2625 * @param enabled true to enable fullscreen
2626 */
2627VLC_API void
2628vlc_player_vout_SetFullscreen(vlc_player_t *player, bool enabled);
2629
2630/**
2631 * Helper to toggle the player fullscreen state
2632 */
2633static inline void
2638}
2639
2640/**
2641 * Check if the player has wallpaper-mode enaled
2642 *
2643 * @warning The wallpaper-mode state of the player and all vouts can be
2644 * different.
2645 *
2646 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2647 * functions.
2648 *
2649 * @see vlc_player_vout_cbs.on_wallpaper_mode_changed
2650 *
2651 * @param player player instance
2652 * @return true if the player is fullscreen
2653 */
2654VLC_API bool
2656
2657/**
2658 * Enable or disable the player wallpaper-mode
2659 *
2660 * This will have an effect on all current and future vouts.
2661 *
2662 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2663 * functions.
2664 * @note A successful call will trigger the
2665 * vlc_player_vout_cbs.on_wallpaper_mode_changed event.
2666 *
2667 * @param player player instance
2668 * @param enabled true to enable wallpaper-mode
2669 */
2670VLC_API void
2672
2673/**
2674 * Helper to toggle the player wallpaper-mode state
2675 */
2676static inline void
2683/**
2684 * Take a snapshot on all vouts
2685 *
2686 * @param player player instance
2687 */
2688VLC_API void
2690
2691/**
2692 * Display an OSD message on all vouts
2693 *
2694 * @param player player instance
2695 * @param fmt format string
2696 */
2697VLC_API void
2698vlc_player_osd_Message(vlc_player_t *player, const char *fmt, ...);
2699
2700/** @} vlc_player__vout */
2701
2702/**
2703 * @defgroup vlc_player__events Player events
2704 * @{
2705 */
2706
2707/**
2708 * Player listener opaque structure.
2709 *
2710 * This opaque structure is returned by vlc_player_AddListener() and can be
2711 * used to remove the listener via vlc_player_RemoveListener().
2712 */
2715/**
2716 * Action of vlc_player_cbs.on_track_list_changed,
2717 * vlc_player_cbs.on_program_list_changed callbacks
2718 */
2726/**
2727 * Player callbacks
2728 *
2729 * Can be registered with vlc_player_AddListener().
2730 *
2731 * All callbacks are called with the player locked (cf. vlc_player_Lock()) and
2732 * from any threads (and even synchronously from a vlc_player function in some
2733 * cases). It is safe to call any vlc_player functions from these callbacks
2734 * except vlc_player_Delete().
2735 *
2736 * @warning To avoid deadlocks, users should never call vlc_player functions
2737 * with an external mutex locked and lock this same mutex from a player
2738 * callback.
2739 */
2740struct vlc_player_cbs
2742 /**
2743 * Called when the current media has changed
2744 *
2745 * @note This can be called from the PLAYING state (when the player plays
2746 * the next media internally) or from the STOPPED state (from
2747 * vlc_player_SetCurrentMedia() or from an internal transition).
2748 *
2749 * The user could set the next media via vlc_player_SetNextMedia() from
2750 * the current callback or anytime before the current media is stopped.
2751
2752 * @see vlc_player_SetCurrentMedia()
2753 *
2754 * @param player locked player instance
2755 * @param new_media new media currently played or NULL (when there is no
2756 * more media to play)
2757 * @param data opaque pointer set by vlc_player_AddListener()
2758 */
2759 void (*on_current_media_changed)(vlc_player_t *player,
2760 input_item_t *new_media, void *data);
2761
2762 /**
2763 * Called when the player state has changed
2764 *
2765 * @see vlc_player_state
2766 *
2767 * @param player locked player instance
2768 * @param new_state new player state
2769 * @param data opaque pointer set by vlc_player_AddListener()
2770 */
2771 void (*on_state_changed)(vlc_player_t *player,
2772 enum vlc_player_state new_state, void *data);
2773
2774 /**
2775 * Called when a media triggered an error
2776 *
2777 * Can be called from any states. When it happens the player will stop
2778 * itself. It is safe to play an other media or event restart the player
2779 * (This will reset the error state).
2780 *
2781 * @param player locked player instance
2782 * @param error player error
2783 * @param data opaque pointer set by vlc_player_AddListener()
2784 */
2785 void (*on_error_changed)(vlc_player_t *player,
2786 enum vlc_player_error error, void *data);
2787
2788 /**
2789 * Called when the player buffering (or cache) has changed
2790 *
2791 * This event is always called with the 0 and 1 values before a playback
2792 * (in case of success). Values in between depends on the media type.
2793 *
2794 * @param player locked player instance
2795 * @param new_buffering buffering in the range [0:1]
2796 * @param data opaque pointer set by vlc_player_AddListener()
2797 */
2798 void (*on_buffering_changed)(vlc_player_t *player,
2799 float new_buffering, void *data);
2800
2801 /**
2802 * Called when the player rate has changed
2803 *
2804 * Triggered by vlc_player_ChangeRate(), not sent when the media starts
2805 * with the default rate (1.f)
2806 *
2807 * @param player locked player instance
2808 * @param new_rate player
2809 * @param data opaque pointer set by vlc_player_AddListener()
2810 */
2811 void (*on_rate_changed)(vlc_player_t *player,
2812 float new_rate, void *data);
2813
2814 /**
2815 * Called when the media capabilities has changed
2816 *
2817 * Always called when the media is opening or stopping.
2818 * Can be called during playback.
2819 *
2820 * @param player locked player instance
2821 * @param old_caps old player capabilities
2822 * @param new_caps new player capabilities
2823 * @param data opaque pointer set by vlc_player_AddListener()
2824 */
2825 void (*on_capabilities_changed)(vlc_player_t *player,
2826 int old_caps, int new_caps, void *data);
2827
2828 /**
2829 * Called when the player position has changed
2830 *
2831 * @note A started and playing media doesn't have necessarily a valid time.
2832 *
2833 * @param player locked player instance
2834 * @param new_time a valid time or VLC_TICK_INVALID
2835 * @param new_pos a valid position
2836 * @param data opaque pointer set by vlc_player_AddListener()
2837 */
2838 void (*on_position_changed)(vlc_player_t *player,
2839 vlc_tick_t new_time, double new_pos, void *data);
2840
2841 /**
2842 * Called when the media length has changed
2843 *
2844 * May be called when the media is opening or during playback.
2845 *
2846 * @note A started and playing media doesn't have necessarily a valid length.
2847 *
2848 * @param player locked player instance
2849 * @param new_length a valid time or VLC_TICK_INVALID
2850 * @param data opaque pointer set by vlc_player_AddListener()
2851 */
2852 void (*on_length_changed)(vlc_player_t *player,
2853 vlc_tick_t new_length, void *data);
2854
2855 /**
2856 * Called when a track is added, removed, or updated
2857 *
2858 * @note The track is only valid from this callback context. Users should
2859 * duplicate this track via vlc_player_track_Dup() if they want to use it
2860 * from an other context.
2861 *
2862 * @param player locked player instance
2863 * @param action added, removed or updated
2864 * @param track valid track
2865 * @param data opaque pointer set by vlc_player_AddListener()
2866 */
2867 void (*on_track_list_changed)(vlc_player_t *player,
2869 const struct vlc_player_track *track, void *data);
2870
2871 /**
2872 * Called when a new track is selected and/or unselected
2873 *
2874 * @note This event can be called with both unselected_id and selected_id
2875 * valid. This mean that a new track is replacing the old one.
2876 *
2877 * @param player locked player instance
2878 * @param unselected_id valid track id or NULL (when nothing is unselected)
2879 * @param selected_id valid track id or NULL (when nothing is selected)
2880 * @param data opaque pointer set by vlc_player_AddListener()
2881 */
2883 vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data);
2884
2885 /**
2886 * Called when a track delay has changed
2887 *
2888 * @param player locked player instance
2889 * @param es_id valid track id
2890 * @param delay a valid delay or INT64_MAX if the delay of this track is
2891 * canceled
2892 */
2893 void (*on_track_delay_changed)(vlc_player_t *player,
2894 vlc_es_id_t *es_id, vlc_tick_t delay, void *data);
2895
2896 /**
2897 * Called when a new program is added, removed or updated
2898 *
2899 * @note The program is only valid from this callback context. Users should
2900 * duplicate this program via vlc_player_program_Dup() if they want to use
2901 * it from an other context.
2902 *
2903 * @param player locked player instance
2904 * @param action added, removed or updated
2905 * @param prgm valid program
2906 * @param data opaque pointer set by vlc_player_AddListener()
2907 */
2908 void (*on_program_list_changed)(vlc_player_t *player,
2910 const struct vlc_player_program *prgm, void *data);
2911
2912 /**
2913 * Called when a new program is selected and/or unselected
2914 *
2915 * @note This event can be called with both unselected_id and selected_id
2916 * valid. This mean that a new program is replacing the old one.
2917 *
2918 * @param player locked player instance
2919 * @param unselected_id valid program id or -1 (when nothing is unselected)
2920 * @param selected_id valid program id or -1 (when nothing is selected)
2921 * @param data opaque pointer set by vlc_player_AddListener()
2922 */
2924 int unselected_id, int selected_id, void *data);
2925
2926 /**
2927 * Called when the media titles has changed
2928 *
2929 * This event is not called when the opening media doesn't have any titles.
2930 * This title list and all its elements are constant. If an element is to
2931 * be updated, a new list will be sent from this callback.
2932 *
2933 * @note Users should hold this list with vlc_player_title_list_Hold() if
2934 * they want to use it from an other context.
2935 *
2936 * @param player locked player instance
2937 * @param titles valid title list or NULL
2938 * @param data opaque pointer set by vlc_player_AddListener()
2939 */
2940 void (*on_titles_changed)(vlc_player_t *player,
2941 vlc_player_title_list *titles, void *data);
2942
2943 /**
2944 * Called when a new title is selected
2945 *
2946 * There are no events when a title is unselected. Titles are automatically
2947 * unselected when the title list changes. Titles and indexes are always
2948 * valid inside the vlc_player_title_list sent by
2949 * vlc_player_cbs.on_titles_changed.
2950 *
2951 * @param player locked player instance
2952 * @param new_title new selected title
2953 * @param new_idx index of this title
2954 * @param data opaque pointer set by vlc_player_AddListener()
2955 */
2957 const struct vlc_player_title *new_title, size_t new_idx, void *data);
2958
2959 /**
2960 * Called when a new chapter is selected
2961 *
2962 * There are no events when a chapter is unselected. Chapters are
2963 * automatically unselected when the title list changes. Titles, chapters
2964 * and indexes are always valid inside the vlc_player_title_list sent by
2965 * vlc_player_cbs.on_titles_changed.
2966 *
2967 * @param player locked player instance
2968 * @param title selected title
2969 * @param title_idx selected title index
2970 * @param chapter new selected chapter
2971 * @param chapter_idx new selected chapter index
2972 * @param data opaque pointer set by vlc_player_AddListener()
2973 */
2975 const struct vlc_player_title *title, size_t title_idx,
2976 const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx,
2977 void *data);
2978
2979 /**
2980 * Called when the media has a teletext menu
2981 *
2982 * @param player locked player instance
2983 * @param has_teletext_menu true if the media has a teletext menu
2984 * @param data opaque pointer set by vlc_player_AddListener()
2985 */
2986 void (*on_teletext_menu_changed)(vlc_player_t *player,
2987 bool has_teletext_menu, void *data);
2988
2989 /**
2990 * Called when teletext is enabled or disabled
2991 *
2992 * @see vlc_player_SetTeletextEnabled()
2993 *
2994 * @param player locked player instance
2995 * @param enabled true if teletext is enabled
2996 * @param data opaque pointer set by vlc_player_AddListener()
2997 */
2999 bool enabled, void *data);
3000
3001 /**
3002 * Called when the teletext page has changed
3003 *
3004 * @see vlc_player_SelectTeletextPage()
3005 *
3006 * @param player locked player instance
3007 * @param new_page page in the range ]0;888]
3008 * @param data opaque pointer set by vlc_player_AddListener()
3009 */
3010 void (*on_teletext_page_changed)(vlc_player_t *player,
3011 unsigned new_page, void *data);
3012
3013 /**
3014 * Called when the teletext transparency has changed
3015 *
3016 * @see vlc_player_SetTeletextTransparency()
3017 *
3018 * @param player locked player instance
3019 * @param enabled true is the teletext overlay is transparent
3020 * @param data opaque pointer set by vlc_player_AddListener()
3021 */
3023 bool enabled, void *data);
3024
3025 /**
3026 * Called when the player category delay has changed for the current media
3027 *
3028 * @see vlc_player_SetCategoryDelay()
3029 *
3030 * @param player locked player instance
3031 * @param cat AUDIO_ES or SPU_ES
3032 * @param new_delay audio delay
3033 * @param data opaque pointer set by vlc_player_AddListener()
3034 */
3036 enum es_format_category_e cat, vlc_tick_t new_delay, void *data);
3037
3038 /**
3039 * Called when associated subtitle has changed
3040 *
3041 * @see vlc_player_SetAssociatedSubsFPS()
3042 *
3043 * @param player locked player instance
3044 * @param sub_fps subtitle fps
3045 * @param data opaque pointer set by vlc_player_AddListener()
3046 */
3048 float subs_fps, void *data);
3049
3050 /**
3051 * Called when a new renderer item is set
3052 *
3053 * @see vlc_player_SetRenderer()
3054 *
3055 * @param player locked player instance
3056 * @param new_item a valid renderer item or NULL (if unset)
3057 * @param data opaque pointer set by vlc_player_AddListener()
3058 */
3059 void (*on_renderer_changed)(vlc_player_t *player,
3060 vlc_renderer_item_t *new_item, void *data);
3061
3062 /**
3063 * Called when the player recording state has changed
3064 *
3065 * @see vlc_player_SetRecordingEnabled()
3066 *
3067 * @param player locked player instance
3068 * @param recording true if recording is enabled
3069 * @param data opaque pointer set by vlc_player_AddListener()
3070 */
3071 void (*on_recording_changed)(vlc_player_t *player,
3072 bool recording, void *data);
3073
3074 /**
3075 * Called when the media signal has changed
3076 *
3077 * @param player locked player instance
3078 * @param new_quality signal quality
3079 * @param new_strength signal strength,
3080 * @param data opaque pointer set by vlc_player_AddListener()
3081 */
3082 void (*on_signal_changed)(vlc_player_t *player,
3083 float quality, float strength, void *data);
3084
3085 /**
3086 * Called when the player has new statisics
3087 *
3088 * @note The stats structure is only valid from this callback context. It
3089 * can be copied in order to use it from an other context.
3090 *
3091 * @param player locked player instance
3092 * @param stats valid stats, only valid from this context
3093 * @param data opaque pointer set by vlc_player_AddListener()
3094 */
3095 void (*on_statistics_changed)(vlc_player_t *player,
3096 const struct input_stats_t *stats, void *data);
3097
3098 /**
3099 * Called when the A to B loop has changed
3100 *
3101 * @see vlc_player_SetAtoBLoop()
3102 *
3103 * @param player locked player instance
3104 * @param state A, when only A is set, B when both A and B are set, None by
3105 * default
3106 * @param time valid time or VLC_TICK_INVALID of the current state
3107 * @param pos valid pos of the current state
3108 * @param data opaque pointer set by vlc_player_AddListener()
3109 */
3110 void (*on_atobloop_changed)(vlc_player_t *player,
3111 enum vlc_player_abloop new_state, vlc_tick_t time, double pos,
3112 void *data);
3113
3114 /**
3115 * Called when the media meta and/or info has changed
3116 *
3117 * @param player locked player instance
3118 * @param media current media
3119 * @param data opaque pointer set by vlc_player_AddListener()
3120 */
3121 void (*on_media_meta_changed)(vlc_player_t *player,
3122 input_item_t *media, void *data);
3123
3124 /**
3125 * Called when media epg has changed
3126 *
3127 * @param player locked player instance
3128 * @param media current media
3129 * @param data opaque pointer set by vlc_player_AddListener()
3130 */
3131 void (*on_media_epg_changed)(vlc_player_t *player,
3132 input_item_t *media, void *data);
3133
3134 /**
3135 * Called when the media has new subitems
3136 *
3137 * @param player locked player instance
3138 * @param media current media
3139 * @param new_subitems node representing all media subitems
3140 * @param data opaque pointer set by vlc_player_AddListener()
3141 */
3143 input_item_t *media, input_item_node_t *new_subitems, void *data);
3144
3145 /**
3146 * Called when new attachments are added to the media
3147 *
3148 * @note It can be called several times for one parse request. The array
3149 * contains only new elements after a second call.
3150 *
3151 * @param player locked player instance
3152 * @param media current media
3153 * @param array valid array containing new elements, should only be used
3154 * within the callback. One and all elements can be held and stored on a
3155 * new variable or new array.
3156 * @param count number of elements in the array
3157 * @param data opaque pointer set by vlc_player_AddListener()
3158 */
3160 input_item_t *media, input_attachment_t *const *array, size_t count,
3161 void *data);
3162
3163 /**
3164 * Called when a vout is started or stopped
3165 *
3166 * @note In case, several media with only one video track are played
3167 * successively, the same vout instance will be started and stopped several
3168 * time.
3169 *
3170 * @param player locked player instance
3171 * @param action started or stopped
3172 * @param vout vout (can't be NULL)
3173 * @param order vout order
3174 * @param es_id the ES id associated with this vout
3175 * @param data opaque pointer set by vlc_player_AddListener()
3176 */
3177 void (*on_vout_changed)(vlc_player_t *player,
3179 enum vlc_vout_order order, vlc_es_id_t *es_id, void *data);
3180
3181 /**
3182 * Called when the player is corked
3183 *
3184 * The player can be corked when the audio output loose focus or when a
3185 * renderer was paused from the outside.
3186 *
3187 * @note called only if pause on cork was not set to true (by
3188 * vlc_player_SetPauseOnCork())
3189 * @note a cork_count higher than 0 means the player is corked. In that
3190 * case, the user should pause the player and release all external resource
3191 * needed by the player. A value higher than 1 mean that the player was
3192 * corked more than one time (for different reasons). A value of 0 means
3193 * the player is no longer corked. In that case, the user could resume the
3194 * player.
3195 *
3196 * @param player locked player instance
3197 * @param cork_count 0 for uncorked, > 0 for corked
3198 * @param data opaque pointer set by vlc_player_AddListener()
3199 */
3200 void (*on_cork_changed)(vlc_player_t *player, unsigned cork_count,
3201 void *data);
3202
3203 /**
3204 * Called to query the user about restoring the previous playback position
3205 *
3206 * If this callback isn't provided, the user won't be asked to restore
3207 * the previous playback position, effectively causing
3208 * VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK to be handled as
3209 * VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER
3210 *
3211 * The implementation can react to this callback by calling
3212 * vlc_player_RestorePlaybackPos(), or by discarding the event.
3213 *
3214 * @param player locked player instance
3215 * @param data opaque pointer set by vlc_player_AddListener()
3216 */
3217 void (*on_playback_restore_queried)(vlc_player_t *player, void *data);
3219 /**
3220 * Called when the player will stop the current media.
3221 *
3222 * @note This can be called from the PLAYING state, before the
3223 * player requests the next media, or from the STOPPING state, ie.
3224 * when the player is stopping.
3225 *
3226 * @see vlc_player_SetCurrentMedia()
3227 * @see vlc_player_Stop()
3228 *
3229 * @param player locked player instance
3230 * @param prev_media media currently stopping
3231 * @param data opaque pointer set by vlc_player_AddListener()
3232 */
3234 input_item_t *current_media, void *data);
3235};
3236
3237/**
3238 * Add a listener callback
3239 *
3240 * @note Every registered callbacks need to be removed by the caller with
3241 * vlc_player_RemoveListener().
3242 *
3243 * @param player locked player instance
3244 * @param cbs pointer to a vlc_player_cbs structure, the structure must be
3245 * valid during the lifetime of the player
3246 * @param cbs_data opaque pointer used by the callbacks
3247 * @return a valid listener id, or NULL in case of allocation error
3248 */
3251 const struct vlc_player_cbs *cbs, void *cbs_data);
3252
3253/**
3254 * Remove a listener callback
3255 *
3256 * @param player locked player instance
3257 * @param listener_id listener id returned by vlc_player_AddListener()
3258 */
3259VLC_API void
3261 vlc_player_listener_id *listener_id);
3262
3263/** @} vlc_player__events */
3264
3265/**
3266 * @defgroup vlc_player__timer Player timer
3267 * @{
3268 */
3269
3270/**
3271 * Player timer opaque structure.
3272 */
3275/**
3276 * Player timer point
3277 *
3278 * @see vlc_player_timer_cbs.on_update
3279 */
3282 /** Position in the range [0.0f;1.0] */
3283 double position;
3284 /** Rate of the player */
3285 double rate;
3286 /** Valid time >= VLC_TICK_0 or VLC_TICK_INVALID, subtract this time with
3287 * VLC_TICK_0 to get the original value. */
3288 vlc_tick_t ts;
3289 /** Valid length >= VLC_TICK_0 or VLC_TICK_INVALID */
3291 /** System date of this record (always valid), this date can be in the
3292 * future or in the past. The special value of INT64_MAX mean that the
3293 * clock was paused when this point was updated. In that case,
3294 * vlc_player_timer_point_Interpolate() will return the current ts/pos of
3295 * this point (there is nothing to interpolate). */
3298
3299/**
3300 * Player smpte timecode
3301 *
3302 * @see vlc_player_timer_smpte_cbs
3303 */
3306 /** Hours [0;n] */
3307 unsigned hours;
3308 /** Minutes [0;59] */
3309 unsigned minutes;
3310 /** Seconds [0;59] */
3311 unsigned seconds;
3312 /** Frame number [0;n] */
3313 unsigned frames;
3314 /** Maximum number of digits needed to display the frame number */
3315 unsigned frame_resolution;
3316 /** True if the source is NTSC 29.97fps or 59.94fps DF */
3317 bool drop_frame;
3319
3320/**
3321 * Player timer callbacks
3322 *
3323 * @see vlc_player_AddTimer
3324 */
3327 /**
3328 * Called when the state or the time changed.
3329 *
3330 * Get notified when the time is updated by the input or output source. The
3331 * input source is the 'demux' or the 'access_demux'. The output source are
3332 * audio and video outputs: an update is received each time a video frame
3333 * is displayed or an audio sample is written. The delay between each
3334 * updates may depend on the input and source type (it can be every 5ms,
3335 * 30ms, 1s or 10s...). The user of this timer may need to update the
3336 * position at a higher frequency from its own mainloop via
3337 * vlc_player_timer_point_Interpolate().
3338 *
3339 * @warning The player is not locked from this callback. It is forbidden
3340 * to call any player functions from here.
3341 *
3342 * @param value always valid, the time corresponding to the state
3343 * @param data opaque pointer set by vlc_player_AddTimer()
3344 */
3345 void (*on_update)(const struct vlc_player_timer_point *value, void *data);
3347 /**
3348 * The player is paused or a discontinuity occurred, likely caused by seek
3349 * from the user or because the playback is stopped. The player user should
3350 * stop its "interpolate" timer.
3351 *
3352 * @param system_date system date of this event, only valid when paused. It
3353 * can be used to interpolate the last updated point to this date in order
3354 * to get the last paused ts/position.
3355 * @param data opaque pointer set by vlc_player_AddTimer()
3356 */
3357 void (*on_discontinuity)(vlc_tick_t system_date, void *data);
3359 /**
3360 * Called when the player is seeking or finished seeking
3361 *
3362 * @param value point of the seek request or NULL when seeking is finished
3363 * value.system_date = VLC_TICK_MAX in that case
3364 * @param data opaque pointer set by vlc_player_AddTimer()
3365 */
3366 void (*on_seek)(const struct vlc_player_timer_point *value, void *data);
3368
3369/**
3370 * Player smpte timer callbacks
3371 *
3372 * @see vlc_player_AddSmpteTimer
3373 */
3376 /**
3377 * Called when a new frame is displayed
3378
3379 * @warning The player is not locked from this callback. It is forbidden
3380 * to call any player functions from here.
3381 *
3382 * @param tc always valid, the timecode corresponding to the frame just
3383 * displayed
3384 * @param data opaque pointer set by vlc_player_AddTimer()
3385 */
3386 void (*on_update)(const struct vlc_player_timer_smpte_timecode *tc,
3387 void *data);
3388};
3389
3390/**
3391 * Add a timer in order to get times updates
3392 *
3393 * @param player player instance (locked or not)
3394 * @param min_period corresponds to the minimum period between each updates,
3395 * use it to avoid flood from too many source updates, set it to
3396 * VLC_TICK_INVALID to receive all updates.
3397 * @param cbs pointer to a vlc_player_timer_cbs structure, the structure must
3398 * be valid during the lifetime of the player
3399 * @param cbs_data opaque pointer used by the callbacks
3400 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3401 * error
3402 */
3404vlc_player_AddTimer(vlc_player_t *player, vlc_tick_t min_period,
3405 const struct vlc_player_timer_cbs *cbs,
3406 void *cbs_data);
3407
3408/**
3409 * Add a smpte timer in order to get accurate video frame updates
3410 *
3411 * @param player player instance (locked or not)
3412 * @param cbs pointer to a vlc_player_timer_smpte_cbs structure, the structure must
3413 * be valid during the lifetime of the player
3414 * @param cbs_data opaque pointer used by the callbacks
3415 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3416 * error
3417 */
3420 const struct vlc_player_timer_smpte_cbs *cbs,
3421 void *cbs_data);
3422
3423/**
3424 * Remove a player timer
3425 *
3426 * @param player player instance (locked or not)
3427 * @param timer timer created by vlc_player_AddTimer()
3428 */
3429VLC_API void
3431
3432/**
3433 * Interpolate the last timer value to now
3434 *
3435 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3436 * callback
3437 * @param system_now current system date
3438 * @param out_ts pointer where to set the interpolated ts, subtract this time
3439 * with VLC_TICK_0 to get the original value.
3440 * @param out_pos pointer where to set the interpolated position
3441 * @return VLC_SUCCESS in case of success, an error in the interpolated ts is
3442 * negative (could happen during the buffering step)
3443 */
3444VLC_API int
3446 vlc_tick_t system_now,
3447 vlc_tick_t *out_ts, double *out_pos);
3448
3449/**
3450 * Get the date of the next interval
3451 *
3452 * Can be used to setup an UI timer in order to update some widgets at specific
3453 * interval. A next_interval of VLC_TICK_FROM_SEC(1) can be used to update a
3454 * time widget when the media reaches a new second.
3455 *
3456 * @note The media time doesn't necessarily correspond to the system time, that
3457 * is why this function is needed and use the rate of the current point.
3458 *
3459 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3460 * @param system_now current system date
3461 * @param interpolated_ts ts returned by vlc_player_timer_point_Interpolate()
3462 * with the same system now
3463 * @param next_interval next interval
3464 * @return the absolute system date of the next interval
3465 */
3468 vlc_tick_t system_now,
3469 vlc_tick_t interpolated_ts,
3470 vlc_tick_t next_interval);
3471
3472/** @} vlc_player__timer */
3473
3474/** @} vlc_player */
3475
3476#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:2420
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:2459
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:2721
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:959
void vlc_player_RemoveListener(vlc_player_t *player, vlc_player_listener_id *listener_id)
Remove a listener callback.
Definition player.c:978
@ VLC_PLAYER_LIST_ADDED
Definition vlc_player.h:2722
@ VLC_PLAYER_LIST_UPDATED
Definition vlc_player.h:2724
@ VLC_PLAYER_LIST_REMOVED
Definition vlc_player.h:2723
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:1905
void vlc_player_SetPauseOnCork(vlc_player_t *player, bool enabled)
Enable or disable pause on cork event.
Definition player.c:1784
void vlc_player_CondWait(vlc_player_t *player, vlc_cond_t *cond)
Wait on a condition variable.
Definition player.c:952
void vlc_player_Delete(vlc_player_t *player)
Delete a player instance.
Definition player.c:1852
void vlc_player_Unlock(vlc_player_t *player)
Unlock the player.
Definition player.c:946
void vlc_player_Lock(vlc_player_t *player)
Lock the player.
Definition player.c:930
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:1231
@ 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:2168
@ VLC_PLAYER_METADATA_LOUDNESS_MOMENTARY
Ask for momentary loudness measurement.
Definition vlc_player.h:2175
@ VLC_PLAYER_METADATA_LOUDNESS_FULL
Ask for all loudness measurements.
Definition vlc_player.h:2183
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:1266
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:1309
int vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
Set the current media.
Definition player.c:1000
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:1260
vlc_tick_t vlc_player_GetTime(vlc_player_t *player)
Get the time of the current media.
Definition player.c:1373
enum vlc_player_abloop vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, float *a_pos, vlc_tick_t *b_time, float *b_pos)
Get the A to B loop status.
Definition player.c:1509
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:1532
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:1452
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:845
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:1354
int vlc_player_GetCapabilities(vlc_player_t *player)
Get the player capabilities.
Definition player.c:1292
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:1299
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:1254
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:1570
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:1213
bool vlc_player_IsRecording(vlc_player_t *player)
Check if the playing is recording.
Definition player.c:1580
int vlc_player_Start(vlc_player_t *player)
Start the playback of the current media.
Definition player.c:1143
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:1055
#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:1063
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:1415
void vlc_player_DecrementRate(vlc_player_t *player)
Decrement the rate of the player (Slower)
Definition player.c:1360
#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:1776
void vlc_player_DisplayPosition(vlc_player_t *player)
Display the player position on the vout OSD.
Definition player.c:1392
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:1278
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:1761
vlc_object_t * vlc_player_GetV4l2Object(vlc_player_t *player)
Get the V4L2 object used to do controls.
Definition player.c:1829
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:1366
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:1405
void vlc_player_SetNextMedia(vlc_player_t *player, input_item_t *media)
Set the next media.
Definition player.c:1041
double vlc_player_GetPosition(vlc_player_t *player)
Get the position of the current media.
Definition player.c:1384
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:1588
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:1071
enum vlc_player_error vlc_player_GetError(vlc_player_t *player)
Get the error state of the player.
Definition player.c:1285
#define VLC_PLAYER_CAP_CHANGE_RATE
Player capability: can change the rate.
Definition vlc_player.h:311
@ 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:1260
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:256
void vlc_player_SelectNextProgram(vlc_player_t *player)
Select the next program.
Definition player.c:331
size_t vlc_player_GetProgramCount(vlc_player_t *player)
Get the number of programs.
Definition player.c:248
void vlc_player_SelectPrevProgram(vlc_player_t *player)
Select the previous program.
Definition player.c:337
void vlc_player_SelectProgram(vlc_player_t *player, int group_id)
Select a program from an ES group identifier.
Definition player.c:281
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:268
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:1445
void vlc_player_SetRenderer(vlc_player_t *player, vlc_renderer_item_t *renderer)
Set the renderer.
Definition player.c:1425
void vlc_player_SetTeletextTransparency(vlc_player_t *player, bool enabled)
Enable or disable teletext transparency.
Definition player.c:756
void vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page)
Select a teletext page or do an action from a key.
Definition player.c:743
unsigned vlc_player_GetTeletextPage(vlc_player_t *player)
Get the current teletext page.
Definition player.c:789
bool vlc_player_HasTeletextMenu(vlc_player_t *player)
Check if the media has a teletext menu.
Definition player.c:770
void vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled)
Enable or disable teletext.
Definition player.c:730
bool vlc_player_IsTeletextEnabled(vlc_player_t *player)
Check if teletext is enabled.
Definition player.c:777
bool vlc_player_IsTeletextTransparent(vlc_player_t *player)
Check if teletext is transparent.
Definition player.c:796
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:533
void vlc_player_RemoveTimer(vlc_player_t *player, vlc_player_timer_id *timer)
Remove a player timer.
Definition timer.c:577
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:589
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:630
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:555
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:918
vlc_player_title_list * vlc_player_GetTitleList(vlc_player_t *player)
Get the title list of the current media.
Definition player.c:803
static const struct vlc_player_chapter * vlc_player_GetSelectedChapter(vlc_player_t *player)
Helper to get the current selected chapter.
Definition vlc_player.h:1103
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:884
void vlc_player_SelectNextChapter(vlc_player_t *player)
Select the next chapter for the current media.
Definition player.c:906
void vlc_player_SelectNextTitle(vlc_player_t *player)
Select the next title for the current media.
Definition player.c:860
void vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index)
Select a chapter index for the current media.
Definition player.c:894
void vlc_player_SelectTitle(vlc_player_t *player, const struct vlc_player_title *title)
Select a title for the current media.
Definition player.c:841
void vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index)
Select a title index for the current media.
Definition player.c:832
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:850
static const struct vlc_player_title * vlc_player_GetSelectedTitle(vlc_player_t *player)
Helper to get the current selected title.
Definition vlc_player.h:1016
void vlc_player_SelectPrevTitle(vlc_player_t *player)
Select the previous title for the current media.
Definition player.c:872
ssize_t vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
Get the selected title index for the current media.
Definition player.c:810
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:1990
void vlc_player_SetAssociatedSubsFPS(vlc_player_t *player, float fps)
Set the associated subtitle FPS.
Definition player.c:1124
static vlc_tick_t vlc_player_GetVideoDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:1961
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:1659
float vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
Get the associated subtitle FPS.
Definition player.c:1136
static vlc_tick_t vlc_player_GetAudioDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:1941
static vlc_tick_t vlc_player_GetSubtitleDelay(vlc_player_t *player)
Helper to get the subtitle delay.
Definition vlc_player.h:1981
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:1950
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:1970
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:1614
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:1646
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:1699
void vlc_player_SelectPrevTrack(vlc_player_t *player, enum es_format_category_e cat)
Select the Previous track.
Definition player.c:658
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:343
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:356
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:394
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:1812
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:1491
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:1693
void vlc_player_RestartEsId(vlc_player_t *player, vlc_es_id_t *es_id)
Restart a track from an ES identifier.
Definition player.c:686
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:1408
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:576
unsigned vlc_player_GetSubtitleTextScale(vlc_player_t *player)
Get the subtitle text scaling factor.
Definition player.c:1755
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:1652
static void vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable audio tracks.
Definition vlc_player.h:1803
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:1426
static void vlc_player_RestartTrack(vlc_player_t *player, const struct vlc_player_track *track)
Helper to restart a track.
Definition vlc_player.h:1683
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:435
static size_t vlc_player_GetSubtitleTrackCount(vlc_player_t *player)
Helper to get the subtitle track count.
Definition vlc_player.h:1417
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:409
void vlc_player_UnselectEsId(vlc_player_t *player, vlc_es_id_t *es_id)
Unselect a track from an ES identifier.
Definition player.c:665
vlc_player_select_policy
Player selection policy.
Definition vlc_player.h:1287
static size_t vlc_player_GetAudioTrackCount(vlc_player_t *player)
Helper to get the audio track count.
Definition vlc_player.h:1399
char * vlc_player_GetCategoryLanguage(vlc_player_t *player, enum es_format_category_e cat)
Get the language of an ES category.
Definition player.c:714
static void vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable subtitle tracks.
Definition vlc_player.h:1821
static void vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable video tracks.
Definition vlc_player.h:1785
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:695
static bool vlc_player_IsVideoEnabled(vlc_player_t *player)
Helper to check if video tracks are enabled.
Definition vlc_player.h:1794
static size_t vlc_player_GetVideoTrackCount(vlc_player_t *player)
Helper to get the video track count.
Definition vlc_player.h:1381
bool vlc_player_IsTrackCategoryEnabled(vlc_player_t *player, enum es_format_category_e cat)
Check if a track category is enabled.
Definition player.c:1740
void vlc_player_SelectNextTrack(vlc_player_t *player, enum es_format_category_e cat)
Select the next track.
Definition player.c:651
static void vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
Helper to select the subtitle language.
Definition vlc_player.h:1752
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:1390
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:1720
static void vlc_player_ToggleSubtitle(vlc_player_t *player)
Helper to toggle subtitles.
Definition vlc_player.h:1839
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:1555
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:386
static void vlc_player_SelectAudioLanguage(vlc_player_t *player, const char *lang)
Helper to select the audio language.
Definition vlc_player.h:1743
void vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale)
Set the subtitle text scaling factor.
Definition player.c:1748
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:549
static void vlc_player_UnselectTrack(vlc_player_t *player, const struct vlc_player_track *track)
Helper to unselect a track.
Definition vlc_player.h:1642
static bool vlc_player_IsSubtitleEnabled(vlc_player_t *player)
Helper to check if subtitle tracks are enabled.
Definition vlc_player.h:1830
@ VLC_PLAYER_SELECT_SIMULTANEOUS
Select multiple tracks for one category.
Definition vlc_player.h:1300
@ VLC_PLAYER_SELECT_EXCLUSIVE
Only one track per category is selected.
Definition vlc_player.h:1292
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:2494
void vlc_player_osd_Message(vlc_player_t *player, const char *fmt,...)
Display an OSD message on all vouts.
Definition osd.c:89
static void vlc_player_vout_ToggleFullscreen(vlc_player_t *player)
Helper to toggle the player fullscreen state.
Definition vlc_player.h:2635
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:2678
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:2496
@ VLC_PLAYER_VOUT_STARTED
Definition vlc_player.h:2495
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:412
Audio output object.
Definition vlc_aout.h:155
Definition vlc_es.h:633
Definition vlc_input.h:169
Definition vlc_input_item.h:210
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
Definition vlc_input_item.h:551
Audio loudness measurement.
Definition vlc_aout.h:673
Condition variable.
Definition vlc_threads.h:270
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:103
VLC object common members.
Definition vlc_objects.h:53
Player aout callbacks.
Definition vlc_player.h:2285
void(* on_volume_changed)(audio_output_t *aout, float new_volume, void *data)
Called when the volume has changed.
Definition vlc_player.h:2295
void(* on_mute_changed)(audio_output_t *aout, bool new_muted, void *data)
Called when the mute state has changed.
Definition vlc_player.h:2307
void(* on_device_changed)(audio_output_t *aout, const char *device, void *data)
Called when the audio device has changed.
Definition vlc_player.h:2317
Definition player.h:159
Player callbacks.
Definition vlc_player.h:2742
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:2909
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:2853
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:3234
void(* on_recording_changed)(vlc_player_t *player, bool recording, void *data)
Called when the player recording state has changed.
Definition vlc_player.h:3072
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:3143
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:3036
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:3011
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:2826
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:3083
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:2957
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:2760
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:2987
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:3096
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:3122
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:2883
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:3048
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:3132
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:3178
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:2924
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:2941
void(* on_cork_changed)(vlc_player_t *player, unsigned cork_count, void *data)
Called when the player is corked.
Definition vlc_player.h:3201
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:2868
void(* on_teletext_enabled_changed)(vlc_player_t *player, bool enabled, void *data)
Called when teletext is enabled or disabled.
Definition vlc_player.h:2999
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:3218
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:2894
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:2975
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:3111
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:2772
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:2839
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:2799
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:2786
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:3060
void(* on_teletext_transparency_changed)(vlc_player_t *player, bool enabled, void *data)
Called when the teletext transparency has changed.
Definition vlc_player.h:3023
void(* on_rate_changed)(vlc_player_t *player, float new_rate, void *data)
Called when the player rate has changed.
Definition vlc_player.h:2812
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:3160
Player chapter structure.
Definition vlc_player.h:918
const char * name
Chapter name, always valid.
Definition vlc_player.h:920
vlc_tick_t time
Position of this chapter.
Definition vlc_player.h:922
Definition player.h:132
Definition player.h:139
Player program structure.
Definition vlc_player.h:1153
bool selected
True if the program is selected.
Definition vlc_player.h:1159
const char * name
Program name, always valid.
Definition vlc_player.h:1157
int group_id
Id used for vlc_player_SelectProgram()
Definition vlc_player.h:1155
bool scrambled
True if the program is scrambled.
Definition vlc_player.h:1161
Definition player.h:234
vlc_cond_t notify
Definition player.h:282
bool start_paused
Definition player.h:242
input_item_t * media
Definition player.h:255
Player timer callbacks.
Definition vlc_player.h:3327
void(* on_discontinuity)(vlc_tick_t system_date, void *data)
The player is paused or a discontinuity occurred, likely caused by seek from the user or because the ...
Definition vlc_player.h:3358
void(* on_seek)(const struct vlc_player_timer_point *value, void *data)
Called when the player is seeking or finished seeking.
Definition vlc_player.h:3367
void(* on_update)(const struct vlc_player_timer_point *value, void *data)
Called when the state or the time changed.
Definition vlc_player.h:3346
Definition player.h:173
Player timer point.
Definition vlc_player.h:3282
double position
Position in the range [0.0f;1.0].
Definition vlc_player.h:3284
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:3297
double rate
Rate of the player.
Definition vlc_player.h:3286
vlc_tick_t length
Valid length >= VLC_TICK_0 or VLC_TICK_INVALID.
Definition vlc_player.h:3291
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:3289
Player smpte timer callbacks.
Definition vlc_player.h:3376
void(* on_update)(const struct vlc_player_timer_smpte_timecode *tc, void *data)
Called when a new frame is displayed.
Definition vlc_player.h:3387
Player smpte timecode.
Definition vlc_player.h:3306
unsigned seconds
Seconds [0;59].
Definition vlc_player.h:3312
unsigned minutes
Minutes [0;59].
Definition vlc_player.h:3310
unsigned hours
Hours [0;n].
Definition vlc_player.h:3308
bool drop_frame
True if the source is NTSC 29.97fps or 59.94fps DF.
Definition vlc_player.h:3318
unsigned frame_resolution
Maximum number of digits needed to display the frame number.
Definition vlc_player.h:3316
unsigned frames
Frame number [0;n].
Definition vlc_player.h:3314
Definition player.h:50
Player title structure.
Definition vlc_player.h:934
const struct vlc_player_chapter * chapters
Array of chapters, can be NULL.
Definition vlc_player.h:945
size_t chapter_count
Number of chapters, can be 0.
Definition vlc_player.h:943
vlc_tick_t length
Length of the title.
Definition vlc_player.h:938
unsigned flags
Bit flag of VLC_PLAYER_TITLE_MENU and VLC_PLAYER_TITLE_INTERACTIVE.
Definition vlc_player.h:941
const char * name
Title name, always valid.
Definition vlc_player.h:936
Player track structure.
Definition vlc_player.h:1313
bool selected
True if the track is selected.
Definition vlc_player.h:1321
es_format_t fmt
Es format.
Definition vlc_player.h:1319
const char * name
Track name, always valid.
Definition vlc_player.h:1317
vlc_es_id_t * es_id
Id used for any player actions, like vlc_player_SelectEsId()
Definition vlc_player.h:1315
Player vout callbacks.
Definition vlc_player.h:2512
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:2534
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:2522
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:2195
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:2226
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:2209
Audio output modules interface.
This file is a collection of common definitions and types.
es_format_category_e
ES Categories.
Definition vlc_es.h:616
@ SPU_ES
Definition vlc_es.h:620
@ AUDIO_ES
Definition vlc_es.h:619
@ VIDEO_ES
Definition vlc_es.h:618
Input thread interface.
int64_t vlc_tick_t
High precision date or time interval.
Definition vlc_tick.h:48