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