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