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, double *a_pos,
791 vlc_tick_t *b_time, double *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/**
1590 * Cycle through the tracks
1591 *
1592 * If the last track is already selected, a call to this function will disable
1593 * this last track. And a second call will select the first track.
1594 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1595 *
1596 * @param player locked player instance
1597 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1598 * @param next the cycle order
1599 */
1600VLC_API void
1602 enum vlc_vout_order vout_order, bool next);
1603
1604/**
1605 * Helper to select the next track
1606 *
1607 * If the last track is already selected, a call to this function will disable
1608 * this last track. And a second call will select the first track.
1609 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1610 *
1611 * @param player locked player instance
1612 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1613 */
1614static inline void
1616 enum vlc_vout_order vout_order)
1617{
1618 vlc_player_CycleTrack(player, cat, vout_order, true);
1619}
1620
1621/**
1622 * Helper to select the Previous track
1623 *
1624 * If the first track is already selected, a call to this function will disable
1625 * this first track. And a second call will select the last track.
1626 * Unless called on the PRIMARY with a SECONDARY selected, it will cycle through
1627 *
1628 * @param player locked player instance
1629 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1630 */
1631static inline void
1633 enum vlc_vout_order vout_order)
1634{
1635 vlc_player_CycleTrack(player, cat, vout_order, false);
1636}
1637
1638/**
1639 * Unselect a track from an ES identifier
1640 *
1641 * @warning Other tracks of the same category won't be touched.
1642 *
1643 * @note A successful call will trigger the
1644 * vlc_player_cbs.on_track_selection_changed event.
1645 *
1646 * @param player locked player instance
1647 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1648 * vlc_player_GetTrackAt())
1649 */
1650VLC_API void
1652
1653/**
1654 * Helper to unselect a track
1655 */
1656static inline void
1658 const struct vlc_player_track *track)
1659{
1660 vlc_player_UnselectEsId(player, track->es_id);
1661}
1662
1663/**
1664 * Helper to unselect all tracks from an ES category
1665 */
1666static inline void
1669{
1670 size_t count = vlc_player_GetTrackCount(player, cat);
1671 for (size_t i = 0; i < count; ++i)
1672 {
1673 const struct vlc_player_track *track =
1674 vlc_player_GetTrackAt(player, cat, i);
1675 assert(track);
1676 if (track->selected)
1677 vlc_player_UnselectTrack(player, track);
1678 }
1679}
1680
1681/**
1682 * Restart a track from an ES identifier
1683 *
1684 * @note A successful call will trigger the
1685 * vlc_player_cbs.on_track_selection_changed event.
1686 *
1687 * @param player locked player instance
1688 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1689 * vlc_player_GetTrackAt())
1690 */
1691VLC_API void
1693
1694/**
1695 * Helper to restart a track
1696 */
1697static inline void
1699 const struct vlc_player_track *track)
1700{
1701 vlc_player_RestartEsId(player, track->es_id);
1702}
1703
1704/**
1705 * Helper to restart all selected tracks from an ES category
1706 */
1707static inline void
1710{
1711 size_t count = vlc_player_GetTrackCount(player, cat);
1712 for (size_t i = 0; i < count; ++i)
1713 {
1714 const struct vlc_player_track *track =
1715 vlc_player_GetTrackAt(player, cat, i);
1716 assert(track);
1717 if (track->selected)
1718 vlc_player_RestartTrack(player, track);
1719 }
1720}
1721
1722/**
1723 * Select the language for an ES category
1724 *
1725 * @warning The language will only be set for all future played media.
1726 *
1727 * @param player locked player instance
1728 * @param cat AUDIO_ES or SPU_ES
1729 * @param lang comma separated, two or three letters country code, 'any' as a
1730 * fallback or NULL to reset the default state
1731 */
1732VLC_API void
1734 enum es_format_category_e cat,
1735 const char *lang);
1736
1737/**
1738 * Get the language of an ES category
1739 *
1740 * @warning This only reflects the change made by
1741 * vlc_player_SelectCategoryLanguage(). The current playing track doesn't
1742 * necessarily correspond to the returned language.
1743 *
1744 * @see vlc_player_SelectCategoryLanguage
1745 *
1746 * @param player locked player instance
1747 * @param cat AUDIO_ES or SPU_ES
1748 * @return valid language or NULL, need to be freed
1749 */
1750VLC_API char *
1752 enum es_format_category_e cat);
1753
1754/**
1755 * Helper to select the audio language
1756 */
1757static inline void
1758vlc_player_SelectAudioLanguage(vlc_player_t *player, const char *lang)
1761}
1762
1763/**
1764 * Helper to select the subtitle language
1765 */
1766static inline void
1767vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
1770}
1771
1772/**
1773 * Enable or disable a track category
1774 *
1775 * If a track category is disabled, the player won't select any tracks of this
1776 * category automatically or via an user action (vlc_player_SelectTrack()).
1777 *
1778 * @param player locked player instance
1779 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1780 * @param enabled true to enable
1781 */
1782VLC_API void
1784 enum es_format_category_e cat, bool enabled);
1785
1786/**
1787 * Check if a track category is enabled
1788 *
1789 * @param player locked player instance
1790 * @param cat VIDEO_ES, AUDIO_ES or SPU_ES
1791 */
1792VLC_API bool
1794 enum es_format_category_e cat);
1795
1796/**
1797 * Helper to enable or disable video tracks
1798 */
1799static inline void
1800vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
1803}
1804
1805/**
1806 * Helper to check if video tracks are enabled
1807 */
1808static inline bool
1812}
1813
1814/**
1815 * Helper to enable or disable audio tracks
1816 */
1817static inline void
1818vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
1821}
1822
1823/**
1824 * Helper to check if audio tracks are enabled
1825 */
1826static inline bool
1830}
1831
1832/**
1833 * Helper to enable or disable subtitle tracks
1834 */
1835static inline void
1836vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
1839}
1840
1841/**
1842 * Helper to check if subtitle tracks are enabled
1843 */
1844static inline bool
1848}
1849
1850/**
1851 * Helper to toggle subtitles
1852 */
1853static inline void
1856 bool enabled = !vlc_player_IsSubtitleEnabled(player);
1857 vlc_player_SetSubtitleEnabled(player, enabled);
1858}
1859
1860/**
1861 * Set the subtitle text scaling factor
1862 *
1863 * @note This function have an effect only if the subtitle track is a text type.
1864 *
1865 * @param player locked player instance
1866 * @param scale factor in the range [10;500] (default: 100)
1867 */
1868VLC_API void
1869vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale);
1870
1871/**
1872 * Get the subtitle text scaling factor
1873 *
1874 * @param player locked player instance
1875 * @return scale factor
1876 */
1877VLC_API unsigned
1879
1880/** @} vlc_player__tracks */
1881
1882/**
1883 * @defgroup vlc_player__tracks_sync Tracks synchronisation (delay)
1884 * @{
1885 */
1886
1887/**
1888 * Get the delay of an ES category for the current media
1889 *
1890 * @see vlc_player_cbs.on_category_delay_changed
1891 *
1892 * @param player locked player instance
1893 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1894 * @return a valid delay or 0
1895 */
1898
1899/**
1900 * Set the delay of one category for the current media
1901 *
1902 * @note A successful call will trigger the
1903 * vlc_player_cbs.on_category_delay_changed event.
1904 *
1905 * @warning This has no effect on tracks where the delay was set by
1906 * vlc_player_SetEsIdDelay()
1907 *
1908 * @param player locked player instance
1909 * @param cat AUDIO_ES or SPU_ES (VIDEO_ES not supported yet)
1910 * @param delay a valid time
1911 * @param whence absolute or relative
1912 * @return VLC_SUCCESS or VLC_EGENERIC if the category is not handled
1913 */
1914VLC_API int
1916 vlc_tick_t delay, enum vlc_player_whence whence);
1917
1918/**
1919 * Get the delay of a track
1920 *
1921 * @see vlc_player_cbs.on_track_delay_changed
1922 *
1923 * @param player locked player instance
1924 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1925 * vlc_player_GetTrackAt())
1926 * @return a valid delay or INT64_MAX is no delay is set for this track
1927 */
1930
1931/**
1932 * Set the delay of one track
1933 *
1934 * @note A successful call will trigger the
1935 * vlc_player_cbs.on_track_delay_changed event.
1936 *
1937 * @warning Setting the delay of one specific track will override previous and
1938 * future changes of delay made by vlc_player_SetCategoryDelay()
1939 *
1940 * @param player locked player instance
1941 * @param es_id an ES ID (retrieved from vlc_player_cbs.on_track_list_changed or
1942 * vlc_player_GetTrackAt())
1943 * @param delay a valid time or INT64_MAX to use default category delay
1944 * @param whence absolute or relative
1945 * @return VLC_SUCCESS or VLC_EGENERIC if the category of the es_id is not
1946 * handled (VIDEO_ES not supported yet)
1947 */
1948VLC_API int
1950 vlc_tick_t delay, enum vlc_player_whence whence);
1951
1952/**
1953 * Helper to get the audio delay
1954 */
1955static inline vlc_tick_t
1958 return vlc_player_GetCategoryDelay(player, AUDIO_ES);
1959}
1960
1961/**
1962 * Helper to set the audio delay
1963 */
1964static inline void
1967
1968{
1969 vlc_player_SetCategoryDelay(player, AUDIO_ES, delay, whence);
1970}
1971
1972/**
1973 * Helper to get the audio delay
1974 */
1975static inline vlc_tick_t
1978 return vlc_player_GetCategoryDelay(player, VIDEO_ES);
1979}
1980
1981/**
1982 * Helper to set the audio delay
1983 */
1984static inline void
1987
1988{
1989 vlc_player_SetCategoryDelay(player, VIDEO_ES, delay, whence);
1990}
1991
1992/**
1993 * Helper to get the subtitle delay
1994 */
1995static inline vlc_tick_t
1998 return vlc_player_GetCategoryDelay(player, SPU_ES);
1999}
2000
2001/**
2002 * Helper to set the subtitle delay
2003 */
2004static inline void
2007{
2008 vlc_player_SetCategoryDelay(player, SPU_ES, delay, whence);
2009}
2010
2011/**
2012 * Set the associated subtitle FPS
2013 *
2014 * In order to correct the rate of the associated media according to this FPS
2015 * and the media video FPS.
2016 *
2017 * @note A successful call will trigger the
2018 * vlc_player_cbs.on_associated_subs_fps_changed event.
2019 *
2020 * @warning this function will change the rate of all external subtitle files
2021 * associated with the current media.
2022 *
2023 * @param player locked player instance
2024 * @param fps FPS of the subtitle file
2025 */
2026VLC_API void
2028
2029/**
2030 * Get the associated subtitle FPS
2031 *
2032 * @param player locked player instance
2033 * @return fps
2034 */
2035VLC_API float
2037
2038/** @} vlc_player__tracks_sync */
2039
2040/**
2041 * @defgroup vlc_player__teletext Teletext control
2042 * @{
2043 */
2044
2045/**
2046 * Check if the media has a teletext menu
2047 *
2048 * @see vlc_player_cbs.on_teletext_menu_changed
2049 *
2050 * @param player locked player instance
2051 * @return true if the media has a teletext menu
2052 */
2053VLC_API bool
2055
2056/**
2057 * Enable or disable teletext
2058 *
2059 * This function has an effect only if the player has a teletext menu.
2060 *
2061 * @note A successful call will trigger the
2062 * vlc_player_cbs.on_teletext_enabled_changed event.
2063 *
2064 * @param player locked player instance
2065 * @param enabled true to enable
2066 */
2067VLC_API void
2068vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled);
2069
2070/**
2071 * Check if teletext is enabled
2072 *
2073 * @see vlc_player_cbs.on_teletext_enabled_changed
2074 *
2075 * @param player locked player instance
2076 */
2077VLC_API bool
2079
2080/**
2081 * Select a teletext page or do an action from a key
2082 *
2083 * This function has an effect only if the player has a teletext menu.
2084 *
2085 * @note Page keys can be the following: @ref VLC_PLAYER_TELETEXT_KEY_RED,
2086 * @ref VLC_PLAYER_TELETEXT_KEY_GREEN, @ref VLC_PLAYER_TELETEXT_KEY_YELLOW,
2087 * @ref VLC_PLAYER_TELETEXT_KEY_BLUE or @ref VLC_PLAYER_TELETEXT_KEY_INDEX.
2088
2089 * @note A successful call will trigger the
2090 * vlc_player_cbs.on_teletext_page_changed event.
2091 *
2092 * @param player locked player instance
2093 * @param page a page in the range ]0;888] or a valid key
2094 */
2095VLC_API void
2096vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page);
2097
2098/**
2099 * Get the current teletext page
2100 *
2101 * @see vlc_player_cbs.on_teletext_page_changed
2102 *
2103 * @param player locked player instance
2104 */
2105VLC_API unsigned
2107
2108/**
2109 * Enable or disable teletext transparency
2110 *
2111 * This function has an effect only if the player has a teletext menu.
2112
2113 * @note A successful call will trigger the
2114 * vlc_player_cbs.on_teletext_transparency_changed event.
2115 *
2116 * @param player locked player instance
2117 * @param enabled true to enable
2118 */
2119VLC_API void
2121
2122/**
2123 * Check if teletext is transparent
2124 *
2125 * @param player locked player instance
2126 */
2127VLC_API bool
2129
2130/** @} vlc_player__teletext */
2131
2132/**
2133 * @defgroup vlc_player__renderer External renderer control
2134 * @{
2135 */
2136
2137/**
2138 * Set the renderer
2139 *
2140 * Valid for the current media and all future ones.
2141 *
2142 * @note A successful call will trigger the vlc_player_cbs.on_renderer_changed
2143 * event.
2144 *
2145 * @param player locked player instance
2146 * @param renderer a valid renderer item or NULL (to disable it), the item will
2147 * be held by the player
2148 */
2149VLC_API void
2151
2152/**
2153 * Get the renderer
2154 *
2155 * @see vlc_player_cbs.on_renderer_changed
2156 *
2157 * @param player locked player instance
2158 * @return the renderer item set by vlc_player_SetRenderer()
2159 */
2162
2163/** @} vlc_player__renderer */
2164
2165/**
2166 * @defgroup vlc_player__metadata Metadata callbacks
2167 * @{
2168 */
2169
2170/**
2171 * Player metadata listener opaque structure.
2172 *
2173 * This opaque structure is returned by vlc_player_AddMetadataListener() and
2174 * can be used to remove the listener via
2175 * vlc_player_RemoveMetadataListener().
2176 */
2179/**
2180 * Player metadata option
2181 */
2184 /**
2185 * Ask for momentary loudness measurement
2186 *
2187 * Very low CPU usage.
2188 * @see vlc_player_metadata_cbs.on_momentary_loudness_changed
2189 */
2192 /**
2193 * Ask for all loudness measurements
2194 *
2195 * High CPU usage.
2196 * @see vlc_player_metadata_cbs.on_loudness_changed
2197 */
2200
2201/**
2202 * Player metadata callbacks
2203 *
2204 * Can be registered with vlc_player_AddMetadataListener().
2205 *
2206 * @warning To avoid deadlocks, users should never call vlc_player_t functions
2207 * from these callbacks.
2208 */
2211 /**
2212 * Called when the momentary loudness measurement have changed
2213 *
2214 * @see VLC_PLAYER_METADATA_LOUDNESS_MOMEMTARY
2215 *
2216 * Only sent when audio is playing, approximately every 400ms (but can be
2217 * higher, depending on the input sample size).
2218 *
2219 * @param date Absolute date of the measurement. It is most likely in the
2220 * future (0 to 2seconds) depending on the audio output buffer size.
2221 * @param momentary_loudness Momentary loudness
2222 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2223 */
2225 double momentary_loudness,
2226 void *data);
2227
2228 /**
2229 * Called when loudness measurements have changed
2230 *
2231 * @see VLC_PLAYER_METADATA_LOUDNESS_FULL
2232 *
2233 * Only sent when audio is playing, approximately every 400ms (but can be
2234 * higher, depending on the input sample size).
2235 *
2236 * @param date Absolute date of the measurement. It is most likely in the
2237 * future (0 to 2seconds) depending on the audio output buffer size.
2238 * @param loudness loudness measurement
2239 * @param data opaque pointer set by vlc_player_AddMetadataListener()
2240 */
2241 void (*on_loudness_changed)(vlc_tick_t date,
2242 const struct vlc_audio_loudness *loudness,
2243 void *data);
2244};
2245
2246/**
2247 * Add a metadata listener
2248 *
2249 * @note Every registered loudness meter need to be removed by the caller with
2250 * vlc_player_RemoveMetadataListener().
2251 *
2252 * @param player locked player instance
2253 * @param option select which metadata to listen
2254 * @param cbs pointer to a vlc_player_metadata_cbs union, the
2255 * structure must be valid during the lifetime of the player
2256 * @param cbs_data opaque pointer used by the callbacks
2257 * @return a valid listener id, or NULL in case of error (plugin missing)
2258 */
2261 enum vlc_player_metadata_option option,
2262 const union vlc_player_metadata_cbs *cbs,
2263 void *cbs_data);
2264
2265/**
2266 * Remove a metadata listener
2267 *
2268 * @param player player instance
2269 * @param listener_id listener id returned by vlc_player_AddMetadataListener()
2270 */
2271VLC_API void
2273 vlc_player_metadata_listener_id *listener_id);
2274
2275
2276/** @} vlc_player__metadata */
2277
2278/**
2279 * @defgroup vlc_player__aout Audio output control
2280 * @{
2281 */
2282
2283/**
2284 * Player aout listener opaque structure.
2285 *
2286 * This opaque structure is returned by vlc_player_aout_AddListener() and can
2287 * be used to remove the listener via vlc_player_aout_RemoveListener().
2288 */
2291/**
2292 * Player aout callbacks
2293 *
2294 * Can be registered with vlc_player_aout_AddListener().
2295 *
2296 * @warning To avoid deadlocks, users should never call audio_output_t and
2297 * vlc_player_t functions from these callbacks.
2298 */
2301 /**
2302 * Called when the volume has changed
2303 *
2304 * @see vlc_player_aout_SetVolume()
2305 *
2306 * @param aout the main aout of the player
2307 * @param new_volume volume in the range [0;2.f]
2308 * @param data opaque pointer set by vlc_player_aout_AddListener()
2309 */
2310 void (*on_volume_changed)(audio_output_t *aout, float new_volume,
2311 void *data);
2312
2313 /**
2314 * Called when the mute state has changed
2315 *
2316 * @see vlc_player_aout_Mute()
2317 *
2318 * @param aout the main aout of the player
2319 * @param new_mute true if muted
2320 * @param data opaque pointer set by vlc_player_aout_AddListener()
2321 */
2322 void (*on_mute_changed)(audio_output_t *aout, bool new_muted,
2323 void *data);
2324
2325 /**
2326 * Called when the audio device has changed
2327 *
2328 * @param aout the main aout of the player
2329 * @param device the device name
2330 * @param data opaque pointer set by vlc_player_aout_AddListener()
2331 */
2332 void (*on_device_changed)(audio_output_t *aout, const char *device,
2333 void *data);
2334};
2335
2336/**
2337 * Get the audio output
2338 *
2339 * @warning The returned pointer must be released with aout_Release().
2340 *
2341 * @param player player instance
2342 * @return a valid audio_output_t * or NULL (if there is no aouts)
2343 */
2346
2347/**
2348 * Reset the main audio output
2349 *
2350 * @warning The main aout can only by reset if it is not currently used by any
2351 * decoders (before any play).
2352 *
2353 * @param player player instance
2354 */
2355VLC_API void
2357
2358/**
2359 * Add a listener callback for audio output events
2360 *
2361 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2362 * functions.
2363 * @note Every registered callbacks need to be removed by the caller with
2364 * vlc_player_aout_RemoveListener().
2365 *
2366 * @param player player instance
2367 * @param cbs pointer to a vlc_player_aout_cbs structure, the structure must be
2368 * valid during the lifetime of the player
2369 * @param cbs_data opaque pointer used by the callbacks
2370 * @return a valid listener id, or NULL in case of allocation error
2371 */
2374 const struct vlc_player_aout_cbs *cbs,
2375 void *cbs_data);
2376
2377/**
2378 * Remove a aout listener callback
2379 *
2380 * @param player player instance
2381 * @param listener_id listener id returned by vlc_player_aout_AddListener()
2382 */
2383VLC_API void
2385 vlc_player_aout_listener_id *listener_id);
2386
2387/**
2388 * Get the audio volume
2389 *
2390 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2391 * functions.
2392 *
2393 * @see vlc_player_aout_cbs.on_volume_changed
2394 *
2395 * @param player player instance
2396 * @return volume in the range [0;2.f] or -1.f if there is no audio outputs
2397 * (independent of mute)
2398 */
2399VLC_API float
2401
2402/**
2403 * Set the audio volume
2404 *
2405 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2406 * functions.
2407 *
2408 * @note A successful call will trigger the
2409 * vlc_player_vout_cbs.on_volume_changed event.
2410 *
2411 * @param player player instance
2412 * @param volume volume in the range [0;2.f]
2413 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2414 */
2415VLC_API int
2416vlc_player_aout_SetVolume(vlc_player_t *player, float volume);
2417
2418/**
2419 * Increment the audio volume
2420 *
2421 * @see vlc_player_aout_SetVolume()
2422 *
2423 * @param player player instance
2424 * @param steps number of "volume-step"
2425 * @param result pointer to store the resulting volume (can be NULL)
2426 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2427 */
2428VLC_API int
2429vlc_player_aout_IncrementVolume(vlc_player_t *player, int steps, float *result);
2430
2431/**
2432 * Helper to decrement the audio volume
2433 */
2434static inline int
2435vlc_player_aout_DecrementVolume(vlc_player_t *player, int steps, float *result)
2437 return vlc_player_aout_IncrementVolume(player, -steps, result);
2438}
2439
2440/**
2441 * Check if the audio output is muted
2442 *
2443 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2444 * functions.
2445 *
2446 * @see vlc_player_aout_cbs.on_mute_changed
2447 *
2448 * @param player player instance
2449 * @return 0 if not muted, 1 if muted, -1 if there is no audio outputs
2450 */
2451VLC_API int
2453
2454/**
2455 * Mute or unmute the audio output
2456 *
2457 * @note The player instance doesn't need to be locked for vlc_player_aout_*()
2458 * functions.
2459 *
2460 * @note A successful call will trigger the
2461 * vlc_player_aout_cbs.on_mute_changed event.
2462 *
2463 * @param player player instance
2464 * @param mute true to mute
2465 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2466 */
2467VLC_API int
2468vlc_player_aout_Mute(vlc_player_t *player, bool mute);
2469
2470/**
2471 * Helper to toggle the mute state
2472 */
2473static inline int
2476 return vlc_player_aout_Mute(player,
2477 !vlc_player_aout_IsMuted(player));
2478}
2479
2480/**
2481 * Enable or disable an audio filter
2482 *
2483 * @see aout_EnableFilter()
2484 *
2485 * @return VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs
2486 */
2487VLC_API int
2488vlc_player_aout_EnableFilter(vlc_player_t *player, const char *name, bool add);
2489
2490/** @} vlc_player__aout */
2491
2492/**
2493 * @defgroup vlc_player__vout Video output control
2494 * @{
2495 */
2496
2497/**
2498 * Player vout listener opaque structure.
2499 *
2500 * This opaque structure is returned by vlc_player_vout_AddListener() and can
2501 * be used to remove the listener via vlc_player_vout_RemoveListener().
2502 */
2505/**
2506 * action of vlc_player_cbs.on_vout_changed callback
2507 */
2514/**
2515 * Player vout callbacks
2516 *
2517 * Can be registered with vlc_player_vout_AddListener().
2518 *
2519 * @note The state changed from the callbacks can be either applied on the
2520 * player (and all future video outputs), or on a specified video output. The
2521 * state is applied on the player when the vout argument is NULL.
2522 *
2523 * @warning To avoid deadlocks, users should never call vout_thread_t and
2524 * vlc_player_t functions from these callbacks.
2525 */
2528 /**
2529 * Called when the player and/or vout fullscreen state has changed
2530 *
2531 * @see vlc_player_vout_SetFullscreen()
2532 *
2533 * @param vout cf. vlc_player_vout_cbs note
2534 * @param enabled true when fullscreen is enabled
2535 * @param data opaque pointer set by vlc_player_vout_AddListener()
2536 */
2537 void (*on_fullscreen_changed)(vout_thread_t *vout, bool enabled,
2538 void *data);
2539
2540 /**
2541 * Called when the player and/or vout wallpaper mode has changed
2542 *
2543 * @see vlc_player_vout_SetWallpaperModeEnabled()
2544 *
2545 * @param vout cf. vlc_player_vout_cbs note
2546 * @param enabled true when wallpaper mode is enabled
2547 * @param data opaque pointer set by vlc_player_vout_AddListener()
2548 */
2549 void (*on_wallpaper_mode_changed)(vout_thread_t *vout, bool enabled,
2550 void *data);
2551};
2552
2553
2554/**
2555 * Get and hold the main video output
2556 *
2557 * @warning the returned vout_thread_t * must be released with vout_Release().
2558 * @see vlc_players_cbs.on_vout_changed
2559 *
2560 * @note The player is guaranteed to always hold one valid vout. Only vout
2561 * variables can be changed from this instance. The vout returned before
2562 * playback is not necessarily the same one that will be used for playback.
2563 *
2564 * @param player player instance
2565 * @return a valid vout_thread_t * or NULL, cf. warning
2566 */
2569
2570/**
2571 * Get and hold the list of video output
2572 *
2573 * @warning All vout_thread_t * element of the array must be released with
2574 * vout_Release(). The returned array must be freed.
2575 *
2576 * @see vlc_players_cbs.on_vout_changed
2577 *
2578 * @param player player instance
2579 * @param count valid pointer to store the array count
2580 * @return a array of vout_thread_t * or NULL, cf. warning
2581 */
2584
2585/**
2586 * Add a listener callback for video output events
2587 *
2588 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2589 * functions.
2590 * @note Every registered callbacks need to be removed by the caller with
2591 * vlc_player_vout_RemoveListener().
2592 *
2593 * @param player player instance
2594 * @param cbs pointer to a vlc_player_vout_cbs structure, the structure must be
2595 * valid during the lifetime of the player
2596 * @param cbs_data opaque pointer used by the callbacks
2597 * @return a valid listener id, or NULL in case of allocation error
2598 */
2601 const struct vlc_player_vout_cbs *cbs,
2602 void *cbs_data);
2603
2604/**
2605 * Remove a vout listener callback
2606 *
2607 * @param player player instance
2608 * @param listener_id listener id returned by vlc_player_vout_AddListener()
2609 */
2610VLC_API void
2612 vlc_player_vout_listener_id *listener_id);
2613
2614/**
2615 * Check if the player is fullscreen
2616 *
2617 * @warning The fullscreen state of the player and all vouts can be different.
2618 *
2619 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2620 * functions.
2621 *
2622 * @see vlc_player_vout_cbs.on_fullscreen_changed
2623 *
2624 * @param player player instance
2625 * @return true if the player is fullscreen
2626 */
2627VLC_API bool
2629
2630/**
2631 * Enable or disable the player fullscreen state
2632 *
2633 * This will have an effect on all current and future vouts.
2634 *
2635 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2636 * functions.
2637 * @note A successful call will trigger the
2638 * vlc_player_vout_cbs.on_fullscreen_changed event.
2639 *
2640 * @param player player instance
2641 * @param enabled true to enable fullscreen
2642 */
2643VLC_API void
2644vlc_player_vout_SetFullscreen(vlc_player_t *player, bool enabled);
2645
2646/**
2647 * Helper to toggle the player fullscreen state
2648 */
2649static inline void
2654}
2655
2656/**
2657 * Check if the player has wallpaper-mode enaled
2658 *
2659 * @warning The wallpaper-mode state of the player and all vouts can be
2660 * different.
2661 *
2662 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2663 * functions.
2664 *
2665 * @see vlc_player_vout_cbs.on_wallpaper_mode_changed
2666 *
2667 * @param player player instance
2668 * @return true if the player is fullscreen
2669 */
2670VLC_API bool
2672
2673/**
2674 * Enable or disable the player wallpaper-mode
2675 *
2676 * This will have an effect on all current and future vouts.
2677 *
2678 * @note The player instance doesn't need to be locked for vlc_player_vout_*()
2679 * functions.
2680 * @note A successful call will trigger the
2681 * vlc_player_vout_cbs.on_wallpaper_mode_changed event.
2682 *
2683 * @param player player instance
2684 * @param enabled true to enable wallpaper-mode
2685 */
2686VLC_API void
2688
2689/**
2690 * Helper to toggle the player wallpaper-mode state
2691 */
2692static inline void
2699/**
2700 * Take a snapshot on all vouts
2701 *
2702 * @param player player instance
2703 */
2704VLC_API void
2706
2707/**
2708 * Display an OSD message on all vouts
2709 *
2710 * @param player player instance
2711 * @param fmt format string
2712 */
2713VLC_API void
2714vlc_player_osd_Message(vlc_player_t *player, const char *fmt, ...);
2715
2716/** @} vlc_player__vout */
2717
2718/**
2719 * @defgroup vlc_player__events Player events
2720 * @{
2721 */
2722
2723/**
2724 * Player listener opaque structure.
2725 *
2726 * This opaque structure is returned by vlc_player_AddListener() and can be
2727 * used to remove the listener via vlc_player_RemoveListener().
2728 */
2731/**
2732 * Action of vlc_player_cbs.on_track_list_changed,
2733 * vlc_player_cbs.on_program_list_changed callbacks
2734 */
2742/**
2743 * Player callbacks
2744 *
2745 * Can be registered with vlc_player_AddListener().
2746 *
2747 * All callbacks are called with the player locked (cf. vlc_player_Lock()) and
2748 * from any threads (and even synchronously from a vlc_player function in some
2749 * cases). It is safe to call any vlc_player functions from these callbacks
2750 * except vlc_player_Delete().
2751 *
2752 * @warning To avoid deadlocks, users should never call vlc_player functions
2753 * with an external mutex locked and lock this same mutex from a player
2754 * callback.
2755 */
2756struct vlc_player_cbs
2758 /**
2759 * Called when the current media has changed
2760 *
2761 * @note This can be called from the PLAYING state (when the player plays
2762 * the next media internally) or from the STOPPED state (from
2763 * vlc_player_SetCurrentMedia() or from an internal transition).
2764 *
2765 * The user could set the next media via vlc_player_SetNextMedia() from
2766 * the current callback or anytime before the current media is stopped.
2767
2768 * @see vlc_player_SetCurrentMedia()
2769 *
2770 * @param player locked player instance
2771 * @param new_media new media currently played or NULL (when there is no
2772 * more media to play)
2773 * @param data opaque pointer set by vlc_player_AddListener()
2774 */
2775 void (*on_current_media_changed)(vlc_player_t *player,
2776 input_item_t *new_media, void *data);
2777
2778 /**
2779 * Called when the player state has changed
2780 *
2781 * @see vlc_player_state
2782 *
2783 * @param player locked player instance
2784 * @param new_state new player state
2785 * @param data opaque pointer set by vlc_player_AddListener()
2786 */
2787 void (*on_state_changed)(vlc_player_t *player,
2788 enum vlc_player_state new_state, void *data);
2789
2790 /**
2791 * Called when a media triggered an error
2792 *
2793 * Can be called from any states. When it happens the player will stop
2794 * itself. It is safe to play an other media or event restart the player
2795 * (This will reset the error state).
2796 *
2797 * @param player locked player instance
2798 * @param error player error
2799 * @param data opaque pointer set by vlc_player_AddListener()
2800 */
2801 void (*on_error_changed)(vlc_player_t *player,
2802 enum vlc_player_error error, void *data);
2803
2804 /**
2805 * Called when the player buffering (or cache) has changed
2806 *
2807 * This event is always called with the 0 and 1 values before a playback
2808 * (in case of success). Values in between depends on the media type.
2809 *
2810 * @param player locked player instance
2811 * @param new_buffering buffering in the range [0:1]
2812 * @param data opaque pointer set by vlc_player_AddListener()
2813 */
2814 void (*on_buffering_changed)(vlc_player_t *player,
2815 float new_buffering, void *data);
2816
2817 /**
2818 * Called when the player rate has changed
2819 *
2820 * Triggered by vlc_player_ChangeRate(), not sent when the media starts
2821 * with the default rate (1.f)
2822 *
2823 * @param player locked player instance
2824 * @param new_rate player
2825 * @param data opaque pointer set by vlc_player_AddListener()
2826 */
2827 void (*on_rate_changed)(vlc_player_t *player,
2828 float new_rate, void *data);
2829
2830 /**
2831 * Called when the media capabilities has changed
2832 *
2833 * Always called when the media is opening or stopping.
2834 * Can be called during playback.
2835 *
2836 * @param player locked player instance
2837 * @param old_caps old player capabilities
2838 * @param new_caps new player capabilities
2839 * @param data opaque pointer set by vlc_player_AddListener()
2840 */
2841 void (*on_capabilities_changed)(vlc_player_t *player,
2842 int old_caps, int new_caps, void *data);
2843
2844 /**
2845 * Called when the player position has changed
2846 *
2847 * @note A started and playing media doesn't have necessarily a valid time.
2848 *
2849 * @param player locked player instance
2850 * @param new_time a valid time or VLC_TICK_INVALID
2851 * @param new_pos a valid position
2852 * @param data opaque pointer set by vlc_player_AddListener()
2853 */
2854 void (*on_position_changed)(vlc_player_t *player,
2855 vlc_tick_t new_time, double new_pos, void *data);
2856
2857 /**
2858 * Called when the media length has changed
2859 *
2860 * May be called when the media is opening or during playback.
2861 *
2862 * @note A started and playing media doesn't have necessarily a valid length.
2863 *
2864 * @param player locked player instance
2865 * @param new_length a valid time or VLC_TICK_INVALID
2866 * @param data opaque pointer set by vlc_player_AddListener()
2867 */
2868 void (*on_length_changed)(vlc_player_t *player,
2869 vlc_tick_t new_length, void *data);
2870
2871 /**
2872 * Called when a track is added, removed, or updated
2873 *
2874 * @note The track is only valid from this callback context. Users should
2875 * duplicate this track via vlc_player_track_Dup() if they want to use it
2876 * from an other context.
2877 *
2878 * @param player locked player instance
2879 * @param action added, removed or updated
2880 * @param track valid track
2881 * @param data opaque pointer set by vlc_player_AddListener()
2882 */
2883 void (*on_track_list_changed)(vlc_player_t *player,
2885 const struct vlc_player_track *track, void *data);
2886
2887 /**
2888 * Called when a new track is selected and/or unselected
2889 *
2890 * @note This event can be called with both unselected_id and selected_id
2891 * valid. This mean that a new track is replacing the old one.
2892 *
2893 * @param player locked player instance
2894 * @param unselected_id valid track id or NULL (when nothing is unselected)
2895 * @param selected_id valid track id or NULL (when nothing is selected)
2896 * @param data opaque pointer set by vlc_player_AddListener()
2897 */
2899 vlc_es_id_t *unselected_id, vlc_es_id_t *selected_id, void *data);
2900
2901 /**
2902 * Called when a track delay has changed
2903 *
2904 * @param player locked player instance
2905 * @param es_id valid track id
2906 * @param delay a valid delay or INT64_MAX if the delay of this track is
2907 * canceled
2908 */
2909 void (*on_track_delay_changed)(vlc_player_t *player,
2910 vlc_es_id_t *es_id, vlc_tick_t delay, void *data);
2911
2912 /**
2913 * Called when a new program is added, removed or updated
2914 *
2915 * @note The program is only valid from this callback context. Users should
2916 * duplicate this program via vlc_player_program_Dup() if they want to use
2917 * it from an other context.
2918 *
2919 * @param player locked player instance
2920 * @param action added, removed or updated
2921 * @param prgm valid program
2922 * @param data opaque pointer set by vlc_player_AddListener()
2923 */
2924 void (*on_program_list_changed)(vlc_player_t *player,
2926 const struct vlc_player_program *prgm, void *data);
2927
2928 /**
2929 * Called when a new program is selected and/or unselected
2930 *
2931 * @note This event can be called with both unselected_id and selected_id
2932 * valid. This mean that a new program is replacing the old one.
2933 *
2934 * @param player locked player instance
2935 * @param unselected_id valid program id or -1 (when nothing is unselected)
2936 * @param selected_id valid program id or -1 (when nothing is selected)
2937 * @param data opaque pointer set by vlc_player_AddListener()
2938 */
2940 int unselected_id, int selected_id, void *data);
2941
2942 /**
2943 * Called when the media titles has changed
2944 *
2945 * This event is not called when the opening media doesn't have any titles.
2946 * This title list and all its elements are constant. If an element is to
2947 * be updated, a new list will be sent from this callback.
2948 *
2949 * @note Users should hold this list with vlc_player_title_list_Hold() if
2950 * they want to use it from an other context.
2951 *
2952 * @param player locked player instance
2953 * @param titles valid title list or NULL
2954 * @param data opaque pointer set by vlc_player_AddListener()
2955 */
2956 void (*on_titles_changed)(vlc_player_t *player,
2957 vlc_player_title_list *titles, void *data);
2958
2959 /**
2960 * Called when a new title is selected
2961 *
2962 * There are no events when a title is unselected. Titles are automatically
2963 * unselected when the title list changes. Titles and indexes are always
2964 * 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 new_title new selected title
2969 * @param new_idx index of this title
2970 * @param data opaque pointer set by vlc_player_AddListener()
2971 */
2973 const struct vlc_player_title *new_title, size_t new_idx, void *data);
2974
2975 /**
2976 * Called when a new chapter is selected
2977 *
2978 * There are no events when a chapter is unselected. Chapters are
2979 * automatically unselected when the title list changes. Titles, chapters
2980 * and indexes are always valid inside the vlc_player_title_list sent by
2981 * vlc_player_cbs.on_titles_changed.
2982 *
2983 * @param player locked player instance
2984 * @param title selected title
2985 * @param title_idx selected title index
2986 * @param chapter new selected chapter
2987 * @param chapter_idx new selected chapter index
2988 * @param data opaque pointer set by vlc_player_AddListener()
2989 */
2991 const struct vlc_player_title *title, size_t title_idx,
2992 const struct vlc_player_chapter *new_chapter, size_t new_chapter_idx,
2993 void *data);
2994
2995 /**
2996 * Called when the media has a teletext menu
2997 *
2998 * @param player locked player instance
2999 * @param has_teletext_menu true if the media has a teletext menu
3000 * @param data opaque pointer set by vlc_player_AddListener()
3001 */
3002 void (*on_teletext_menu_changed)(vlc_player_t *player,
3003 bool has_teletext_menu, void *data);
3004
3005 /**
3006 * Called when teletext is enabled or disabled
3007 *
3008 * @see vlc_player_SetTeletextEnabled()
3009 *
3010 * @param player locked player instance
3011 * @param enabled true if teletext is enabled
3012 * @param data opaque pointer set by vlc_player_AddListener()
3013 */
3015 bool enabled, void *data);
3016
3017 /**
3018 * Called when the teletext page has changed
3019 *
3020 * @see vlc_player_SelectTeletextPage()
3021 *
3022 * @param player locked player instance
3023 * @param new_page page in the range ]0;888]
3024 * @param data opaque pointer set by vlc_player_AddListener()
3025 */
3026 void (*on_teletext_page_changed)(vlc_player_t *player,
3027 unsigned new_page, void *data);
3028
3029 /**
3030 * Called when the teletext transparency has changed
3031 *
3032 * @see vlc_player_SetTeletextTransparency()
3033 *
3034 * @param player locked player instance
3035 * @param enabled true is the teletext overlay is transparent
3036 * @param data opaque pointer set by vlc_player_AddListener()
3037 */
3039 bool enabled, void *data);
3040
3041 /**
3042 * Called when the player category delay has changed for the current media
3043 *
3044 * @see vlc_player_SetCategoryDelay()
3045 *
3046 * @param player locked player instance
3047 * @param cat AUDIO_ES or SPU_ES
3048 * @param new_delay audio delay
3049 * @param data opaque pointer set by vlc_player_AddListener()
3050 */
3052 enum es_format_category_e cat, vlc_tick_t new_delay, void *data);
3053
3054 /**
3055 * Called when associated subtitle has changed
3056 *
3057 * @see vlc_player_SetAssociatedSubsFPS()
3058 *
3059 * @param player locked player instance
3060 * @param sub_fps subtitle fps
3061 * @param data opaque pointer set by vlc_player_AddListener()
3062 */
3064 float subs_fps, void *data);
3065
3066 /**
3067 * Called when a new renderer item is set
3068 *
3069 * @see vlc_player_SetRenderer()
3070 *
3071 * @param player locked player instance
3072 * @param new_item a valid renderer item or NULL (if unset)
3073 * @param data opaque pointer set by vlc_player_AddListener()
3074 */
3075 void (*on_renderer_changed)(vlc_player_t *player,
3076 vlc_renderer_item_t *new_item, void *data);
3077
3078 /**
3079 * Called when the player recording state has changed
3080 *
3081 * @see vlc_player_SetRecordingEnabled()
3082 *
3083 * @param player locked player instance
3084 * @param recording true if recording is enabled
3085 * @param data opaque pointer set by vlc_player_AddListener()
3086 */
3087 void (*on_recording_changed)(vlc_player_t *player,
3088 bool recording, void *data);
3089
3090 /**
3091 * Called when the media signal has changed
3092 *
3093 * @param player locked player instance
3094 * @param new_quality signal quality
3095 * @param new_strength signal strength,
3096 * @param data opaque pointer set by vlc_player_AddListener()
3097 */
3098 void (*on_signal_changed)(vlc_player_t *player,
3099 float quality, float strength, void *data);
3100
3101 /**
3102 * Called when the player has new statisics
3103 *
3104 * @note The stats structure is only valid from this callback context. It
3105 * can be copied in order to use it from an other context.
3106 *
3107 * @param player locked player instance
3108 * @param stats valid stats, only valid from this context
3109 * @param data opaque pointer set by vlc_player_AddListener()
3110 */
3111 void (*on_statistics_changed)(vlc_player_t *player,
3112 const struct input_stats_t *stats, void *data);
3113
3114 /**
3115 * Called when the A to B loop has changed
3116 *
3117 * @see vlc_player_SetAtoBLoop()
3118 *
3119 * @param player locked player instance
3120 * @param state A, when only A is set, B when both A and B are set, None by
3121 * default
3122 * @param time valid time or VLC_TICK_INVALID of the current state
3123 * @param pos valid pos of the current state
3124 * @param data opaque pointer set by vlc_player_AddListener()
3125 */
3126 void (*on_atobloop_changed)(vlc_player_t *player,
3127 enum vlc_player_abloop new_state, vlc_tick_t time, double pos,
3128 void *data);
3129
3130 /**
3131 * Called when the media meta and/or info has changed
3132 *
3133 * @param player locked player instance
3134 * @param media current media
3135 * @param data opaque pointer set by vlc_player_AddListener()
3136 */
3137 void (*on_media_meta_changed)(vlc_player_t *player,
3138 input_item_t *media, void *data);
3139
3140 /**
3141 * Called when media epg has changed
3142 *
3143 * @param player locked player instance
3144 * @param media current media
3145 * @param data opaque pointer set by vlc_player_AddListener()
3146 */
3147 void (*on_media_epg_changed)(vlc_player_t *player,
3148 input_item_t *media, void *data);
3149
3150 /**
3151 * Called when the media has new subitems
3152 *
3153 * @param player locked player instance
3154 * @param media current media
3155 * @param new_subitems node representing all media subitems
3156 * @param data opaque pointer set by vlc_player_AddListener()
3157 */
3159 input_item_t *media, input_item_node_t *new_subitems, void *data);
3160
3161 /**
3162 * Called when new attachments are added to the media
3163 *
3164 * @note It can be called several times for one parse request. The array
3165 * contains only new elements after a second call.
3166 *
3167 * @param player locked player instance
3168 * @param media current media
3169 * @param array valid array containing new elements, should only be used
3170 * within the callback. One and all elements can be held and stored on a
3171 * new variable or new array.
3172 * @param count number of elements in the array
3173 * @param data opaque pointer set by vlc_player_AddListener()
3174 */
3176 input_item_t *media, input_attachment_t *const *array, size_t count,
3177 void *data);
3178
3179 /**
3180 * Called when a vout is started or stopped
3181 *
3182 * @note In case, several media with only one video track are played
3183 * successively, the same vout instance will be started and stopped several
3184 * time.
3185 *
3186 * @param player locked player instance
3187 * @param action started or stopped
3188 * @param vout vout (can't be NULL)
3189 * @param order vout order
3190 * @param es_id the ES id associated with this vout
3191 * @param data opaque pointer set by vlc_player_AddListener()
3192 */
3193 void (*on_vout_changed)(vlc_player_t *player,
3195 enum vlc_vout_order order, vlc_es_id_t *es_id, void *data);
3196
3197 /**
3198 * Called when the player is corked
3199 *
3200 * The player can be corked when the audio output loose focus or when a
3201 * renderer was paused from the outside.
3202 *
3203 * @note called only if pause on cork was not set to true (by
3204 * vlc_player_SetPauseOnCork())
3205 * @note a cork_count higher than 0 means the player is corked. In that
3206 * case, the user should pause the player and release all external resource
3207 * needed by the player. A value higher than 1 mean that the player was
3208 * corked more than one time (for different reasons). A value of 0 means
3209 * the player is no longer corked. In that case, the user could resume the
3210 * player.
3211 *
3212 * @param player locked player instance
3213 * @param cork_count 0 for uncorked, > 0 for corked
3214 * @param data opaque pointer set by vlc_player_AddListener()
3215 */
3216 void (*on_cork_changed)(vlc_player_t *player, unsigned cork_count,
3217 void *data);
3218
3219 /**
3220 * Called to query the user about restoring the previous playback position
3221 *
3222 * If this callback isn't provided, the user won't be asked to restore
3223 * the previous playback position, effectively causing
3224 * VLC_PLAYER_RESTORE_PLAYBACK_POS_ASK to be handled as
3225 * VLC_PLAYER_RESTORE_PLAYBACK_POS_NEVER
3226 *
3227 * The implementation can react to this callback by calling
3228 * vlc_player_RestorePlaybackPos(), or by discarding the event.
3229 *
3230 * @param player locked player instance
3231 * @param data opaque pointer set by vlc_player_AddListener()
3232 */
3233 void (*on_playback_restore_queried)(vlc_player_t *player, void *data);
3235 /**
3236 * Called when the player will stop the current media.
3237 *
3238 * @note This can be called from the PLAYING state, before the
3239 * player requests the next media, or from the STOPPING state, ie.
3240 * when the player is stopping.
3241 *
3242 * @see vlc_player_SetCurrentMedia()
3243 * @see vlc_player_Stop()
3244 *
3245 * @param player locked player instance
3246 * @param prev_media media currently stopping
3247 * @param data opaque pointer set by vlc_player_AddListener()
3248 */
3250 input_item_t *current_media, void *data);
3251};
3252
3253/**
3254 * Add a listener callback
3255 *
3256 * @note Every registered callbacks need to be removed by the caller with
3257 * vlc_player_RemoveListener().
3258 *
3259 * @param player locked player instance
3260 * @param cbs pointer to a vlc_player_cbs structure, the structure must be
3261 * valid during the lifetime of the player
3262 * @param cbs_data opaque pointer used by the callbacks
3263 * @return a valid listener id, or NULL in case of allocation error
3264 */
3267 const struct vlc_player_cbs *cbs, void *cbs_data);
3268
3269/**
3270 * Remove a listener callback
3271 *
3272 * @param player locked player instance
3273 * @param listener_id listener id returned by vlc_player_AddListener()
3274 */
3275VLC_API void
3277 vlc_player_listener_id *listener_id);
3278
3279/** @} vlc_player__events */
3280
3281/**
3282 * @defgroup vlc_player__timer Player timer
3283 * @{
3284 */
3285
3286/**
3287 * Player timer opaque structure.
3288 */
3291/**
3292 * Player timer point
3293 *
3294 * @see vlc_player_timer_cbs.on_update
3295 */
3298 /** Position in the range [0.0f;1.0] */
3299 double position;
3300 /** Rate of the player */
3301 double rate;
3302 /** Valid time >= VLC_TICK_0 or VLC_TICK_INVALID, subtract this time with
3303 * VLC_TICK_0 to get the original value. */
3304 vlc_tick_t ts;
3305 /** Valid length >= VLC_TICK_0 or VLC_TICK_INVALID */
3307 /** System date of this record (always valid), this date can be in the
3308 * future or in the past. The special value of INT64_MAX mean that the
3309 * clock was paused when this point was updated. In that case,
3310 * vlc_player_timer_point_Interpolate() will return the current ts/pos of
3311 * this point (there is nothing to interpolate). */
3314
3315/**
3316 * Player smpte timecode
3317 *
3318 * @see vlc_player_timer_smpte_cbs
3319 */
3322 /** Hours [0;n] */
3323 unsigned hours;
3324 /** Minutes [0;59] */
3325 unsigned minutes;
3326 /** Seconds [0;59] */
3327 unsigned seconds;
3328 /** Frame number [0;n] */
3329 unsigned frames;
3330 /** Maximum number of digits needed to display the frame number */
3331 unsigned frame_resolution;
3332 /** True if the source is NTSC 29.97fps or 59.94fps DF */
3333 bool drop_frame;
3335
3336/**
3337 * Player timer callbacks
3338 *
3339 * @see vlc_player_AddTimer
3340 */
3343 /**
3344 * Called when the state or the time changed (mandatory).
3345 *
3346 * Get notified when the time is updated by the input or output source. The
3347 * input source is the 'demux' or the 'access_demux'. The output source are
3348 * audio and video outputs: an update is received each time a video frame
3349 * is displayed or an audio sample is written. The delay between each
3350 * updates may depend on the input and source type (it can be every 5ms,
3351 * 30ms, 1s or 10s...). The user of this timer may need to update the
3352 * position at a higher frequency from its own mainloop via
3353 * vlc_player_timer_point_Interpolate().
3354 *
3355 * @warning The player is not locked from this callback. It is forbidden
3356 * to call any player functions from here.
3357 *
3358 * @param value always valid, the time corresponding to the state
3359 * @param data opaque pointer set by vlc_player_AddTimer()
3360 */
3361 void (*on_update)(const struct vlc_player_timer_point *value, void *data);
3363 /**
3364 * The player timer is paused (can be NULL).
3365 *
3366 * This event is sent when the player is paused or stopping. The player
3367 * user should stop its "interpolate" timer.
3368 *
3369 * @note on_update() can be called when paused for those 2 reasons:
3370 * - playback is resumed (vlc_player_timer_point.system_date is valid)
3371 * - a track, likely video (next-frame) is outputted when paused
3372 * (vlc_player_timer_point.system_date = INT64_MAX)
3373 *
3374 * @warning The player is not locked from this callback. It is forbidden
3375 * to call any player functions from here.
3376 *
3377 * @param system_date system date of this event, not valid when stopped. It
3378 * can be used to interpolate the last updated point to this date in order
3379 * to get the last paused ts/position.
3380 * @param data opaque pointer set by vlc_player_AddTimer()
3381 */
3382 void (*on_paused)(vlc_tick_t system_date, void *data);
3384 /**
3385 * Called when the player is seeking or finished seeking (can be NULL).
3386 *
3387 * @warning The player is not locked from this callback. It is forbidden
3388 * to call any player functions from here.
3389 *
3390 * @note on_update() can be called when seeking. It corresponds to tracks
3391 * updating their points prior to receiving the asynchronous seek event.
3392 * The user could discard them manually.
3393 *
3394 * @param value point of the seek request or NULL when seeking is finished
3395 * @param data opaque pointer set by vlc_player_AddTimer()
3396 */
3397 void (*on_seek)(const struct vlc_player_timer_point *value, void *data);
3399
3400/**
3401 * Player smpte timer callbacks
3402 *
3403 * @see vlc_player_AddSmpteTimer
3404 */
3407 /**
3408 * Called when a new frame is displayed
3409
3410 * @warning The player is not locked from this callback. It is forbidden
3411 * to call any player functions from here.
3412 *
3413 * @param tc always valid, the timecode corresponding to the frame just
3414 * displayed
3415 * @param data opaque pointer set by vlc_player_AddTimer()
3416 */
3417 void (*on_update)(const struct vlc_player_timer_smpte_timecode *tc,
3418 void *data);
3419};
3420
3421/**
3422 * Add a timer in order to get times updates
3423 *
3424 * @param player player instance (locked or not)
3425 * @param min_period corresponds to the minimum period between each updates,
3426 * use it to avoid flood from too many source updates, set it to
3427 * VLC_TICK_INVALID to receive all updates.
3428 * @param cbs pointer to a vlc_player_timer_cbs structure, the structure must
3429 * be valid during the lifetime of the player
3430 * @param cbs_data opaque pointer used by the callbacks
3431 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3432 * error
3433 */
3435vlc_player_AddTimer(vlc_player_t *player, vlc_tick_t min_period,
3436 const struct vlc_player_timer_cbs *cbs,
3437 void *cbs_data);
3438
3439/**
3440 * Add a smpte timer in order to get accurate video frame updates
3441 *
3442 * @param player player instance (locked or not)
3443 * @param cbs pointer to a vlc_player_timer_smpte_cbs structure, the structure must
3444 * be valid during the lifetime of the player
3445 * @param cbs_data opaque pointer used by the callbacks
3446 * @return a valid vlc_player_timer_id or NULL in case of memory allocation
3447 * error
3448 */
3451 const struct vlc_player_timer_smpte_cbs *cbs,
3452 void *cbs_data);
3453
3454/**
3455 * Remove a player timer
3456 *
3457 * @param player player instance (locked or not)
3458 * @param timer timer created by vlc_player_AddTimer()
3459 */
3460VLC_API void
3462
3463/**
3464 * Interpolate the last timer value to now
3465 *
3466 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3467 * callback
3468 * @param system_now current system date
3469 * @param out_ts pointer where to set the interpolated ts, subtract this time
3470 * with VLC_TICK_0 to get the original value.
3471 * @param out_pos pointer where to set the interpolated position
3472 * @return VLC_SUCCESS in case of success, an error in the interpolated ts is
3473 * negative (could happen during the buffering step)
3474 */
3475VLC_API int
3477 vlc_tick_t system_now,
3478 vlc_tick_t *out_ts, double *out_pos);
3479
3480/**
3481 * Get the date of the next interval
3482 *
3483 * Can be used to setup an UI timer in order to update some widgets at specific
3484 * interval. A next_interval of VLC_TICK_FROM_SEC(1) can be used to update a
3485 * time widget when the media reaches a new second.
3486 *
3487 * @note The media time doesn't necessarily correspond to the system time, that
3488 * is why this function is needed and use the rate of the current point.
3489 *
3490 * @param point time update obtained via the vlc_player_timer_cbs.on_update()
3491 * @param system_now current system date
3492 * @param interpolated_ts ts returned by vlc_player_timer_point_Interpolate()
3493 * with the same system now
3494 * @param next_interval next interval
3495 * @return the absolute system date of the next interval
3496 */
3499 vlc_tick_t system_now,
3500 vlc_tick_t interpolated_ts,
3501 vlc_tick_t next_interval);
3502
3503/** @} vlc_player__timer */
3504
3505/** @} vlc_player */
3506
3507#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:2436
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:2475
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:2737
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:967
void vlc_player_RemoveListener(vlc_player_t *player, vlc_player_listener_id *listener_id)
Remove a listener callback.
Definition player.c:986
@ VLC_PLAYER_LIST_ADDED
Definition vlc_player.h:2738
@ VLC_PLAYER_LIST_UPDATED
Definition vlc_player.h:2740
@ VLC_PLAYER_LIST_REMOVED
Definition vlc_player.h:2739
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:1913
void vlc_player_SetPauseOnCork(vlc_player_t *player, bool enabled)
Enable or disable pause on cork event.
Definition player.c:1792
void vlc_player_CondWait(vlc_player_t *player, vlc_cond_t *cond)
Wait on a condition variable.
Definition player.c:960
void vlc_player_Delete(vlc_player_t *player)
Delete a player instance.
Definition player.c:1860
void vlc_player_Unlock(vlc_player_t *player)
Unlock the player.
Definition player.c:954
void vlc_player_Lock(vlc_player_t *player)
Lock the player.
Definition player.c:938
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:1239
@ 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:2184
@ VLC_PLAYER_METADATA_LOUDNESS_MOMENTARY
Ask for momentary loudness measurement.
Definition vlc_player.h:2191
@ VLC_PLAYER_METADATA_LOUDNESS_FULL
Ask for all loudness measurements.
Definition vlc_player.h:2199
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:1274
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:1317
int vlc_player_SetCurrentMedia(vlc_player_t *player, input_item_t *media)
Set the current media.
Definition player.c:1008
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:1268
vlc_tick_t vlc_player_GetTime(vlc_player_t *player)
Get the time of the current media.
Definition player.c:1381
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:1540
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:1460
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:1362
int vlc_player_GetCapabilities(vlc_player_t *player)
Get the player capabilities.
Definition player.c:1300
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:1307
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:1262
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:1578
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:1221
bool vlc_player_IsRecording(vlc_player_t *player)
Check if the playing is recording.
Definition player.c:1588
int vlc_player_Start(vlc_player_t *player)
Start the playback of the current media.
Definition player.c:1151
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:1063
#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:1071
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:1423
enum vlc_player_abloop vlc_player_GetAtoBLoop(vlc_player_t *player, vlc_tick_t *a_time, double *a_pos, vlc_tick_t *b_time, double *b_pos)
Get the A to B loop status.
Definition player.c:1517
void vlc_player_DecrementRate(vlc_player_t *player)
Decrement the rate of the player (Slower)
Definition player.c:1368
#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:1784
void vlc_player_DisplayPosition(vlc_player_t *player)
Display the player position on the vout OSD.
Definition player.c:1400
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:1286
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:1769
vlc_object_t * vlc_player_GetV4l2Object(vlc_player_t *player)
Get the V4L2 object used to do controls.
Definition player.c:1837
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:1374
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:1413
void vlc_player_SetNextMedia(vlc_player_t *player, input_item_t *media)
Set the next media.
Definition player.c:1049
double vlc_player_GetPosition(vlc_player_t *player)
Get the position of the current media.
Definition player.c:1392
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:1596
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:1079
enum vlc_player_error vlc_player_GetError(vlc_player_t *player)
Get the error state of the player.
Definition player.c:1293
#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:1453
void vlc_player_SetRenderer(vlc_player_t *player, vlc_renderer_item_t *renderer)
Set the renderer.
Definition player.c:1433
void vlc_player_SetTeletextTransparency(vlc_player_t *player, bool enabled)
Enable or disable teletext transparency.
Definition player.c:764
void vlc_player_SelectTeletextPage(vlc_player_t *player, unsigned page)
Select a teletext page or do an action from a key.
Definition player.c:751
unsigned vlc_player_GetTeletextPage(vlc_player_t *player)
Get the current teletext page.
Definition player.c:797
bool vlc_player_HasTeletextMenu(vlc_player_t *player)
Check if the media has a teletext menu.
Definition player.c:778
void vlc_player_SetTeletextEnabled(vlc_player_t *player, bool enabled)
Enable or disable teletext.
Definition player.c:738
bool vlc_player_IsTeletextEnabled(vlc_player_t *player)
Check if teletext is enabled.
Definition player.c:785
bool vlc_player_IsTeletextTransparent(vlc_player_t *player)
Check if teletext is transparent.
Definition player.c:804
vlc_player_timer_id * vlc_player_AddTimer(vlc_player_t *player, vlc_tick_t min_period, const struct vlc_player_timer_cbs *cbs, void *cbs_data)
Add a timer in order to get times updates.
Definition timer.c:562
void vlc_player_RemoveTimer(vlc_player_t *player, vlc_player_timer_id *timer)
Remove a player timer.
Definition timer.c:606
int vlc_player_timer_point_Interpolate(const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t *out_ts, double *out_pos)
Interpolate the last timer value to now.
Definition timer.c:618
vlc_tick_t vlc_player_timer_point_GetNextIntervalDate(const struct vlc_player_timer_point *point, vlc_tick_t system_now, vlc_tick_t interpolated_ts, vlc_tick_t next_interval)
Get the date of the next interval.
Definition timer.c:659
vlc_player_timer_id * vlc_player_AddSmpteTimer(vlc_player_t *player, const struct vlc_player_timer_smpte_cbs *cbs, void *cbs_data)
Add a smpte timer in order to get accurate video frame updates.
Definition timer.c:584
vlc_player_title_list * vlc_player_title_list_Hold(vlc_player_title_list *titles)
Hold the title list of the player.
Definition title.c:32
void vlc_player_SelectPrevChapter(vlc_player_t *player)
Select the previous chapter for the current media.
Definition player.c:926
vlc_player_title_list * vlc_player_GetTitleList(vlc_player_t *player)
Get the title list of the current media.
Definition player.c:811
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:892
void vlc_player_SelectNextChapter(vlc_player_t *player)
Select the next chapter for the current media.
Definition player.c:914
void vlc_player_SelectNextTitle(vlc_player_t *player)
Select the next title for the current media.
Definition player.c:868
void vlc_player_SelectChapterIdx(vlc_player_t *player, size_t index)
Select a chapter index for the current media.
Definition player.c:902
void vlc_player_SelectTitle(vlc_player_t *player, const struct vlc_player_title *title)
Select a title for the current media.
Definition player.c:849
void vlc_player_SelectTitleIdx(vlc_player_t *player, size_t index)
Select a title index for the current media.
Definition player.c:840
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:858
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:880
ssize_t vlc_player_GetSelectedTitleIdx(vlc_player_t *player)
Get the selected title index for the current media.
Definition player.c:818
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:2006
void vlc_player_SetAssociatedSubsFPS(vlc_player_t *player, float fps)
Set the associated subtitle FPS.
Definition player.c:1132
static vlc_tick_t vlc_player_GetVideoDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:1977
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:1667
float vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
Get the associated subtitle FPS.
Definition player.c:1144
static vlc_tick_t vlc_player_GetAudioDelay(vlc_player_t *player)
Helper to get the audio delay.
Definition vlc_player.h:1957
static vlc_tick_t vlc_player_GetSubtitleDelay(vlc_player_t *player)
Helper to get the subtitle delay.
Definition vlc_player.h:1997
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:1966
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:1986
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:1622
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:1654
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:1707
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:1828
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:1709
void vlc_player_RestartEsId(vlc_player_t *player, vlc_es_id_t *es_id)
Restart a track from an ES identifier.
Definition player.c:694
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:1763
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:1668
static void vlc_player_SetAudioEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable audio tracks.
Definition vlc_player.h:1819
void vlc_player_CycleTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order, bool next)
Cycle through the tracks.
Definition player.c:600
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:1699
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:673
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:722
static void vlc_player_SetSubtitleEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable subtitle tracks.
Definition vlc_player.h:1837
static void vlc_player_SelectPrevTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order)
Helper to select the Previous track.
Definition vlc_player.h:1633
static void vlc_player_SetVideoEnabled(vlc_player_t *player, bool enabled)
Helper to enable or disable video tracks.
Definition vlc_player.h:1801
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:703
static bool vlc_player_IsVideoEnabled(vlc_player_t *player)
Helper to check if video tracks are enabled.
Definition vlc_player.h:1810
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:1748
static void vlc_player_SelectSubtitleLanguage(vlc_player_t *player, const char *lang)
Helper to select the subtitle language.
Definition vlc_player.h:1768
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:1728
static void vlc_player_ToggleSubtitle(vlc_player_t *player)
Helper to toggle subtitles.
Definition vlc_player.h:1855
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
static void vlc_player_SelectNextTrack(vlc_player_t *player, enum es_format_category_e cat, enum vlc_vout_order vout_order)
Helper to select the next track.
Definition vlc_player.h:1616
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:1759
void vlc_player_SetSubtitleTextScale(vlc_player_t *player, unsigned scale)
Set the subtitle text scaling factor.
Definition player.c:1756
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:1658
static bool vlc_player_IsSubtitleEnabled(vlc_player_t *player)
Helper to check if subtitle tracks are enabled.
Definition vlc_player.h:1846
@ 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:2510
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:2651
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:2694
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:2512
@ VLC_PLAYER_VOUT_STARTED
Definition vlc_player.h:2511
const char name[16]
Definition httpd.c:1298
input_item_t * input_item_Hold(input_item_t *p_item)
Holds an input item, i.e.
Definition item.c:401
Audio output object.
Definition vlc_aout.h:155
Definition vlc_es.h:633
Definition vlc_input.h:169
Definition vlc_input_item.h:204
Describes an input and is used to spawn input_thread_t objects.
Definition vlc_input_item.h:98
Definition vlc_input_item.h:529
Audio loudness measurement.
Definition vlc_aout.h:667
Condition variable.
Definition vlc_threads.h:270
Opaque structure representing an ES (Elementary Stream) track.
Definition es_out.c:104
VLC object common members.
Definition vlc_objects.h:53
Player aout callbacks.
Definition vlc_player.h:2301
void(* on_volume_changed)(audio_output_t *aout, float new_volume, void *data)
Called when the volume has changed.
Definition vlc_player.h:2311
void(* on_mute_changed)(audio_output_t *aout, bool new_muted, void *data)
Called when the mute state has changed.
Definition vlc_player.h:2323
void(* on_device_changed)(audio_output_t *aout, const char *device, void *data)
Called when the audio device has changed.
Definition vlc_player.h:2333
Definition player.h:159
Player callbacks.
Definition vlc_player.h:2758
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:2925
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:2869
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:3250
void(* on_recording_changed)(vlc_player_t *player, bool recording, void *data)
Called when the player recording state has changed.
Definition vlc_player.h:3088
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:3159
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:3052
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:3027
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:2842
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:3099
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:2973
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:2776
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:3003
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:3112
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:3138
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:2899
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:3064
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:3148
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:3194
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:2940
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:2957
void(* on_cork_changed)(vlc_player_t *player, unsigned cork_count, void *data)
Called when the player is corked.
Definition vlc_player.h:3217
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:2884
void(* on_teletext_enabled_changed)(vlc_player_t *player, bool enabled, void *data)
Called when teletext is enabled or disabled.
Definition vlc_player.h:3015
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:3234
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:2910
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:2991
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:3127
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:2788
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:2855
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:2815
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:2802
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:3076
void(* on_teletext_transparency_changed)(vlc_player_t *player, bool enabled, void *data)
Called when the teletext transparency has changed.
Definition vlc_player.h:3039
void(* on_rate_changed)(vlc_player_t *player, float new_rate, void *data)
Called when the player rate has changed.
Definition vlc_player.h:2828
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:3176
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:236
vlc_cond_t notify
Definition player.h:284
bool start_paused
Definition player.h:244
input_item_t * media
Definition player.h:257
Player timer callbacks.
Definition vlc_player.h:3343
void(* on_seek)(const struct vlc_player_timer_point *value, void *data)
Called when the player is seeking or finished seeking (can be NULL).
Definition vlc_player.h:3398
void(* on_update)(const struct vlc_player_timer_point *value, void *data)
Called when the state or the time changed (mandatory).
Definition vlc_player.h:3362
void(* on_paused)(vlc_tick_t system_date, void *data)
The player timer is paused (can be NULL).
Definition vlc_player.h:3383
Definition player.h:173
Player timer point.
Definition vlc_player.h:3298
double position
Position in the range [0.0f;1.0].
Definition vlc_player.h:3300
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:3313
double rate
Rate of the player.
Definition vlc_player.h:3302
vlc_tick_t length
Valid length >= VLC_TICK_0 or VLC_TICK_INVALID.
Definition vlc_player.h:3307
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:3305
Player smpte timer callbacks.
Definition vlc_player.h:3407
void(* on_update)(const struct vlc_player_timer_smpte_timecode *tc, void *data)
Called when a new frame is displayed.
Definition vlc_player.h:3418
Player smpte timecode.
Definition vlc_player.h:3322
unsigned seconds
Seconds [0;59].
Definition vlc_player.h:3328
unsigned minutes
Minutes [0;59].
Definition vlc_player.h:3326
unsigned hours
Hours [0;n].
Definition vlc_player.h:3324
bool drop_frame
True if the source is NTSC 29.97fps or 59.94fps DF.
Definition vlc_player.h:3334
unsigned frame_resolution
Maximum number of digits needed to display the frame number.
Definition vlc_player.h:3332
unsigned frames
Frame number [0;n].
Definition vlc_player.h:3330
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:2528
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:2550
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:2538
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:2211
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:2242
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:2225
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