forked from videolan/vlc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvlc_player.h
2798 lines (2570 loc) · 79.9 KB
/
vlc_player.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*****************************************************************************
* vlc_player.h: player interface
*****************************************************************************
* Copyright (C) 2018 VLC authors and VideoLAN
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef VLC_PLAYER_H
#define VLC_PLAYER_H 1
#include <vlc_input.h>
#include <vlc_aout.h>
/**
* @defgroup player Player
* @ingroup input
* VLC Player API
* @brief
@dot
digraph player_states {
label="Player state diagram";
new [style="invis"];
started [label="Started" URL="@ref VLC_PLAYER_STATE_STARTED"];
playing [label="Playing" URL="@ref VLC_PLAYER_STATE_PLAYING"];
paused [label="Paused" URL="@ref VLC_PLAYER_STATE_PAUSED"];
stopping [label="Stopping" URL="@ref VLC_PLAYER_STATE_STOPPING"];
stopped [label="Stopped" URL="@ref VLC_PLAYER_STATE_STOPPED"];
new -> stopped [label="vlc_player_New()" URL="@ref vlc_player_New" fontcolor="green3"];
started -> playing [style="dashed" label=<<i>internal transition</i>>];
started -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
playing -> paused [label="vlc_player_Pause()" URL="@ref vlc_player_Pause" fontcolor="blue"];
paused -> playing [label="vlc_player_Resume()" URL="@ref vlc_player_Resume" fontcolor="blue3"];
paused -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
playing -> stopping [label="vlc_player_Stop()" URL="@ref vlc_player_Stop" fontcolor="red"];
stopping -> stopped [style="dashed" label=<<i>internal transition</i>>];
stopped -> started [label="vlc_player_Start()" URL="@ref vlc_player_Start" fontcolor="darkgreen"];
}
@enddot
* @{
* @file
* VLC Player API
*/
/**
* Player opaque structure.
*/
typedef struct vlc_player_t vlc_player_t;
/**
* Player listener opaque structure.
*
* This opaque structure is returned by vlc_player_AddListener() and can be
* used to remove the listener via vlc_player_RemoveListener().
*/
typedef struct vlc_player_listener_id vlc_player_listener_id;
/**
* Player vout listener opaque structure.
*
* This opaque structure is returned by vlc_player_vout_AddListener() and can
* be used to remove the listener via vlc_player_vout_RemoveListener().
*/
typedef struct vlc_player_vout_listener_id vlc_player_vout_listener_id;
/**
* Player aout listener opaque structure.
*
* This opaque structure is returned by vlc_player_aout_AddListener() and can
* be used to remove the listener via vlc_player_aout_RemoveListener().
*/
typedef struct vlc_player_aout_listener_id vlc_player_aout_listener_id;
/**
* Player program structure.
*/
struct vlc_player_program
{
/** Id used for vlc_player_SelectProgram() */
int group_id;
/** Program name, always valid */
const char *name;
/** True if the program is selected */
bool selected;
/** True if the program is scrambled */
bool scrambled;
};
/**
* Player track structure.
*/
struct vlc_player_track
{
/** Id used for any player actions, like vlc_player_SelectTrack() */
vlc_es_id_t *es_id;
/** Track name, always valid */
const char *name;
/** Es format */
es_format_t fmt;
/** True if the track is selected */
bool selected;
};
/**
* Player chapter structure
*/
struct vlc_player_chapter
{
/** Chapter name, always valid */
const char *name;
/** Position of this chapter */
vlc_tick_t time;
};
/** vlc_player_title.flags: The title is a menu. */
#define VLC_PLAYER_TITLE_MENU 0x01
/** vlc_player_title.flags: The title is interactive. */
#define VLC_PLAYER_TITLE_INTERACTIVE 0x02
/** Player title structure */
struct vlc_player_title
{
/** Title name, always valid */
const char *name;
/** Length of the title */
vlc_tick_t length;
/** Bit flag of @ref VLC_PLAYER_TITLE_MENU and @ref
* VLC_PLAYER_TITLE_INTERACTIVE */
unsigned flags;
/** Number of chapters, can be 0 */
size_t chapter_count;
/** Array of chapters, can be NULL */
const struct vlc_player_chapter *chapters;
};
/**
* Opaque structure representing a list of @ref vlc_player_title.
*
* @see vlc_player_GetTitleList()
* @see vlc_player_title_list_GetCount()
* @see vlc_player_title_list_GetAt()
*/
typedef struct vlc_player_title_list vlc_player_title_list;
/**
* Menu (VCD/DVD/BD) and viewpoint navigations
*
* @see vlc_player_Navigate()
*/
enum vlc_player_nav
{
/** Activate the navigation item selected */
VLC_PLAYER_NAV_ACTIVATE,
/** Select a navigation item above or move the viewpoint up */
VLC_PLAYER_NAV_UP,
/** Select a navigation item under or move the viewpoint down */
VLC_PLAYER_NAV_DOWN,
/** Select a navigation item on the left or move the viewpoint left */
VLC_PLAYER_NAV_LEFT,
/** Select a navigation item on the right or move the viewpoint right */
VLC_PLAYER_NAV_RIGHT,
/** Activate the popup Menu (for BD) */
VLC_PLAYER_NAV_POPUP,
/** Activate disc Root Menu */
VLC_PLAYER_NAV_MENU,
};
/**
* Action of vlc_player_cbs.on_track_list_changed,
* vlc_player_cbs.on_program_list_changed, and
* vlc_player_cbs.on_vout_list_changed callbacks
*/
enum vlc_player_list_action
{
VLC_PLAYER_LIST_ADDED,
VLC_PLAYER_LIST_REMOVED,
VLC_PLAYER_LIST_UPDATED,
};
/**
* State of the player
*
* During a normal playback (no errors), the user is expected to receive all
* events in the following order: STARTED, PLAYING, STOPPING, STOPPED.
*
* @note When playing more than one media in a row, the player stay at the
* PLAYING state when doing the transition from the current media to the next
* media (that can be gapless). This means that STOPPING, STOPPED states (for
* the current media) and STARTED, PLAYING states (for the next one) won't be
* sent. Nevertheless, the vlc_player_cbs.on_current_media_changed callback
* will be called during this transition.
*/
enum vlc_player_state
{
/**
* The player is stopped
*
* Initial state, or triggered by an internal transition from the STOPPING
* state.
*/
VLC_PLAYER_STATE_STOPPED,
/**
* The player is started
*
* Triggered by vlc_player_Start()
*/
VLC_PLAYER_STATE_STARTED,
/**
* The player is playing
*
* Triggered by vlc_player_Resume() or by an internal transition from the
* STARTED state.
*/
VLC_PLAYER_STATE_PLAYING,
/**
* The player is paused
*
* Triggered by vlc_player_Pause().
*/
VLC_PLAYER_STATE_PAUSED,
/**
* The player is stopping
*
* Triggered by vlc_player_Stop(), vlc_player_SetCurrentMedia() or by an
* internal transition (when the media reach the end of file for example).
*/
VLC_PLAYER_STATE_STOPPING,
};
/**
* Error of the player
*
* @see vlc_player_GetError()
*/
enum vlc_player_error
{
VLC_PLAYER_ERROR_NONE,
VLC_PLAYER_ERROR_GENERIC,
};
/**
* Seek speed type
*
* @see vlc_player_SeekByPos()
* @see vlc_player_SeekByTime()
*/
enum vlc_player_seek_speed
{
/** Do a precise seek */
VLC_PLAYER_SEEK_PRECISE,
/** Do a fast seek */
VLC_PLAYER_SEEK_FAST,
};
/**
* Player seek/delay directive
*
* @see vlc_player_SeekByPos()
* @see vlc_player_SeekByTime()
* @see vlc_player_SetAudioDelay()
* @see vlc_player_SetSubtitleDelay()
*/
enum vlc_player_whence
{
/** Given time/position */
VLC_PLAYER_WHENCE_ABSOLUTE,
/** The current position +/- the given time/position */
VLC_PLAYER_WHENCE_RELATIVE,
};
/**
* Action when the player is stopped
*
* @see vlc_player_SetMediaStoppedAction()
*/
enum vlc_player_media_stopped_action {
/** Continue (or stop if there is no next media), default behavior */
VLC_PLAYER_MEDIA_STOPPED_CONTINUE,
/** Pause when reaching the end of file */
VLC_PLAYER_MEDIA_STOPPED_PAUSE,
/** Stop, even if there is a next media to play */
VLC_PLAYER_MEDIA_STOPPED_STOP,
/** Exit VLC */
VLC_PLAYER_MEDIA_STOPPED_EXIT,
};
/**
* A to B loop state
*/
enum vlc_player_abloop
{
VLC_PLAYER_ABLOOP_NONE,
VLC_PLAYER_ABLOOP_A,
VLC_PLAYER_ABLOOP_B,
};
/**
* Subtitle synchronisation
*
* @see vlc_player_SetSubtitleSync()
*/
enum vlc_player_subtitle_sync
{
VLC_PLAYER_SUBTITLE_SYNC_RESET,
VLC_PLAYER_SUBTITLE_SYNC_MARK_AUDIO,
VLC_PLAYER_SUBTITLE_SYNC_MARK_SUBTITLE,
VLC_PLAYER_SUBTITLE_SYNC_APPLY,
};
/**
* Vout filter type
*
* @warning Temporary enum, waiting for a refined vout filter API
*
* @see vlc_player_vout_SetFilter()
*/
enum vlc_vout_filter_type
{
VLC_VOUT_FILTER_VIDEO_FILTER,
VLC_VOUT_FILTER_SUB_SOURCE,
VLC_VOUT_FILTER_SUB_FILTER,
};
/** Player capability: can seek */
#define VLC_PLAYER_CAP_SEEK (1<<0)
/** Player capability: can pause */
#define VLC_PLAYER_CAP_PAUSE (1<<1)
/** Player capability: can change the rate */
#define VLC_PLAYER_CAP_CHANGE_RATE (1<<2)
/** Player capability: can seek back */
#define VLC_PLAYER_CAP_REWIND (1<<3)
/** Player teletext key: Red */
#define VLC_PLAYER_TELETEXT_KEY_RED ('r' << 16)
/** Player teletext key: Green */
#define VLC_PLAYER_TELETEXT_KEY_GREEN ('g' << 16)
/** Player teletext key: Yellow */
#define VLC_PLAYER_TELETEXT_KEY_YELLOW ('y' << 16)
/** Player teletext key: Blue */
#define VLC_PLAYER_TELETEXT_KEY_BLUE ('b' << 16)
/** Player teletext key: Index */
#define VLC_PLAYER_TELETEXT_KEY_INDEX ('i' << 16)
/**
* Callbacks for the owner of the player.
*
* These callbacks are needed to control the player flow (via the
* vlc_playlist_t as a owner for example). It can only be set when creating the
* player via vlc_player_New().
*
* All callbacks are called with the player locked (cf. vlc_player_Lock()), and
* from any thread (even the current one).
*/
struct vlc_player_media_provider
{
/**
* Called when the player requires a new media
*
* @note The returned media must be already held with input_item_Hold()
*
* @param player locked player instance
* @param data opaque pointer set from vlc_player_New()
* @return the next media to play, held by the callee with input_item_Hold()
*/
input_item_t *(*get_next)(vlc_player_t *player, void *data);
};
/**
* Player callbacks
*
* Can be registered with vlc_player_AddListener().
*
* All callbacks are called with the player locked (cf. vlc_player_Lock()) and
* from any threads (and even synchronously from a vlc_player function in some
* cases). It is safe to call any vlc_player functions from these callbacks
* except vlc_player_Delete().
*
* @warning To avoid deadlocks, users should never call vlc_player functions
* with an external mutex locked and lock this same mutex from a player
* callback.
*/
struct vlc_player_cbs
{
/**
* Called when the current media has changed
*
* @note This can be called from the PLAYING state (when the player plays
* the next media internally) or from the STOPPED state (from
* vlc_player_SetCurrentMedia() or from an internal transition).
*
* @see vlc_player_SetCurrentMedia()
* @see vlc_player_InvalidateNextMedia()
*
* @param player locked player instance
* @param new_media new media currently played or NULL (when there is no
* more media to play)
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_current_media_changed)(vlc_player_t *player,
input_item_t *new_media, void *data);
/**
* Called when the player state has changed
*
* @see vlc_player_state
*
* @param player locked player instance
* @param new_state new player state
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_state_changed)(vlc_player_t *player,
enum vlc_player_state new_state, void *data);
/**
* Called when a media triggered an error
*
* Can be called from any states. When it happens the player will stop
* itself. It is safe to play an other media or event restart the player
* (This will reset the error state).
*
* @param player locked player instance
* @param error player error
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_error_changed)(vlc_player_t *player,
enum vlc_player_error error, void *data);
/**
* Called when the player buffering (or cache) has changed
*
* This event is always called with the 0 and 1 values before a playback
* (in case of success). Values in between depends on the media type.
*
* @param player locked player instance
* @param new_buffering buffering in the range [0:1]
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_buffering_changed)(vlc_player_t *player,
float new_buffering, void *data);
/**
* Called when the player rate has changed
*
* Triggered by vlc_player_ChangeRate(), not sent when the media starts
* with the default rate (1.f)
*
* @param player locked player instance
* @param new_rate player
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_rate_changed)(vlc_player_t *player,
float new_rate, void *data);
/**
* Called when the media capabilities has changed
*
* Always called when the media is opening. Can be called during playback.
*
* @param player locked player instance
* @param new_caps player capabilities
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_capabilities_changed)(vlc_player_t *player,
int new_caps, void *data);
/**
* Called when the player position has changed
*
* @note A started and playing media doesn't have necessarily a valid time.
*
* @param player locked player instance
* @param new_time a valid time or VLC_TICK_INVALID
* @param new_pos a valid position
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_position_changed)(vlc_player_t *player,
vlc_tick_t new_time, float new_pos, void *data);
/**
* Called when the media length has changed
*
* May be called when the media is opening or during playback.
*
* @note A started and playing media doesn't have necessarily a valid length.
*
* @param player locked player instance
* @param new_length a valid time or VLC_TICK_INVALID
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_length_changed)(vlc_player_t *player,
vlc_tick_t new_length, void *data);
/**
* Called when a track is added, removed, or updated
*
* @note The track is only valid from this callback context. Users should
* duplicate this track via vlc_player_track_Dup() if they want to use it
* from an other context.
*
* @param player locked player instance
* @param action added, removed or updated
* @param track valid track
* @param data opaque pointer set by vlc_player_AddListener()
*/
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 new track is selected and/or unselected
*
* @note This event can be called with both unselected_id and selected_id
* valid. This mean that a new track is replacing the old one.
*
* @param player locked player instance
* @param unselected_id valid track id or NULL (when nothing is unselected)
* @param selected_id valid track id or NULL (when nothing is selected)
* @param data opaque pointer set by vlc_player_AddListener()
*/
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 program is added, removed or updated
*
* @note The program is only valid from this callback context. Users should
* duplicate this program via vlc_player_program_Dup() if they want to use
* it from an other context.
*
* @param player locked player instance
* @param action added, removed or updated
* @param prgm valid program
* @param data opaque pointer set by vlc_player_AddListener()
*/
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 selected and/or unselected
*
* @note This event can be called with both unselected_id and selected_id
* valid. This mean that a new program is replacing the old one.
*
* @param player locked player instance
* @param unselected_id valid program id or -1 (when nothing is unselected)
* @param selected_id valid program id or -1 (when nothing is selected)
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_program_selection_changed)(vlc_player_t *player,
int unselected_id, int selected_id, void *data);
/**
* Called when the media titles has changed
*
* This event is not called when the opening media doesn't have any titles.
* This title list and all its elements are constant. If an element is to
* be updated, a new list will be sent from this callback.
*
* @note Users should hold this list with vlc_player_title_list_Hold() if
* they want to use it from an other context.
*
* @param player locked player instance
* @param titles valid title list or NULL
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_titles_changed)(vlc_player_t *player,
vlc_player_title_list *titles, void *data);
/**
* Called when a new title is selected
*
* There are no events when a title is unselected. Titles are automatically
* unselected when the title list changes. Titles and indexes are always
* valid inside the vlc_player_title_list sent by
* vlc_player_cbs.on_titles_changed.
*
* @param player locked player instance
* @param new_title new selected title
* @param new_idx index of this title
* @param data opaque pointer set by vlc_player_AddListener()
*/
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 chapter is selected
*
* There are no events when a chapter is unselected. Chapters are
* automatically unselected when the title list changes. Titles, chapters
* and indexes are always valid inside the vlc_player_title_list sent by
* vlc_player_cbs.on_titles_changed.
*
* @param player locked player instance
* @param title selected title
* @param title_idx selected title index
* @param chapter new selected chapter
* @param chapter_idx new selected chapter index
* @param data opaque pointer set by vlc_player_AddListener()
*/
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 the media has a teletext menu
*
* @param player locked player instance
* @param has_teletext_menu true if the media has a teletext menu
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_teletext_menu_changed)(vlc_player_t *player,
bool has_teletext_menu, void *data);
/**
* Called when teletext is enabled or disabled
*
* @see vlc_player_SetTeletextEnabled()
*
* @param player locked player instance
* @param enabled true if teletext is enabled
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_teletext_enabled_changed)(vlc_player_t *player,
bool enabled, void *data);
/**
* Called when the teletext page has changed
*
* @see vlc_player_SelectTeletextPage()
*
* @param player locked player instance
* @param new_page page in the range ]0;888]
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_teletext_page_changed)(vlc_player_t *player,
unsigned new_page, void *data);
/**
* Called when the teletext transparency has changed
*
* @see vlc_player_SetTeletextTransparency()
*
* @param player locked player instance
* @param enabled true is the teletext overlay is transparent
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_teletext_transparency_changed)(vlc_player_t *player,
bool enabled, void *data);
/**
* Called when the player audio delay has changed
*
* @see vlc_player_SetAudioDelay()
*
* @param player locked player instance
* @param new_delay audio delay
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_audio_delay_changed)(vlc_player_t *player,
vlc_tick_t new_delay, void *data);
/**
* Called when the player subtitle delay has changed
*
* @see vlc_player_SetSubtitleDelay()
*
* @param player locked player instance
* @param new_delay subtitle delay
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_subtitle_delay_changed)(vlc_player_t *player,
vlc_tick_t new_delay, void *data);
/**
* Called when associated subtitle has changed
*
* @see vlc_player_SetAssociatedSubsFPS()
*
* @param player locked player instance
* @param sub_fps subtitle fps
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_associated_subs_fps_changed)(vlc_player_t *player,
float subs_fps, void *data);
/**
* Called when a new renderer item is set
*
* @see vlc_player_SetRenderer()
*
* @param player locked player instance
* @param new_item a valid renderer item or NULL (if unset)
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_renderer_changed)(vlc_player_t *player,
vlc_renderer_item_t *new_item, void *data);
/**
* Called when the player recording state has changed
*
* @see vlc_player_SetRecordingEnabled()
*
* @param player locked player instance
* @param recording true if recording is enabled
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_recording_changed)(vlc_player_t *player,
bool recording, void *data);
/**
* Called when the media signal has changed
*
* @param player locked player instance
* @param new_quality signal quality
* @param new_strength signal strength,
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_signal_changed)(vlc_player_t *player,
float quality, float strength, void *data);
/**
* Called when the player has new statisics
*
* @note The stats structure is only valid from this callback context. It
* can be copied in order to use it from an other context.
*
* @param player locked player instance
* @param stats valid stats, only valid from this context
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_statistics_changed)(vlc_player_t *player,
const struct input_stats_t *stats, void *data);
/**
* Called when the A to B loop has changed
*
* @see vlc_player_SetAtoBLoop()
*
* @param player locked player instance
* @param state A, when only A is set, B when both A and B are set, None by
* default
* @param time valid time or VLC_TICK_INVALID of the current state
* @param pos valid pos of the current state
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_atobloop_changed)(vlc_player_t *player,
enum vlc_player_abloop new_state, vlc_tick_t time, float pos,
void *data);
/**
* Called when media stopped action has changed
*
* @see vlc_player_SetMediaStoppedAction()
*
* @param player locked player instance
* @param new_action action to execute when a media is stopped
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_media_stopped_action_changed)(vlc_player_t *player,
enum vlc_player_media_stopped_action new_action, void *data);
/**
* Called when the media meta has changed
*
* @param player locked player instance
* @param media current media
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_media_meta_changed)(vlc_player_t *player,
input_item_t *media, void *data);
/**
* Called when media epg has changed
*
* @param player locked player instance
* @param media current media
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_media_epg_changed)(vlc_player_t *player,
input_item_t *media, void *data);
/**
* Called when the media has new subitems
*
* @param player locked player instance
* @param media current media
* @param new_subitems node representing all media subitems
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_media_subitems_changed)(vlc_player_t *player,
input_item_t *media, input_item_node_t *new_subitems, void *data);
/**
* Called when a new vout is added or removed
*
* @param player locked player instance
* @param action added or removed
* @param vout new vout
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_vout_list_changed)(vlc_player_t *player,
enum vlc_player_list_action action, vout_thread_t *vout, void *data);
/**
* Called when the player is corked
*
* The player can be corked when the audio output loose focus or when a
* renderer was paused from the outside.
*
* @note called only if pause on cork was not set to true (by
* vlc_player_SetPauseOnCork())
* @note a cork_count higher than 0 means the player is corked. In that
* case, the user should pause the player and release all external resource
* needed by the player. A value higher than 1 mean that the player was
* corked more than one time (for different reasons). A value of 0 means
* the player is no longer corked. In that case, the user could resume the
* player.
*
* @param player locked player instance
* @param cork_count 0 for uncorked, > 0 for corked
* @param data opaque pointer set by vlc_player_AddListener()
*/
void (*on_cork_changed)(vlc_player_t *player, unsigned cork_count,
void *data);
};
/**
* Player vout callbacks
*
* Can be registered with vlc_player_vout_AddListener().
*
* These callbacks are *not* called with the player locked. It is safe to lock
* the player and call any vlc_player functions from these callbacks.
*
* @note The state changed from the callbacks can be either applied on the
* player (and all future video outputs), or on a specified video output. The
* state is applied on the player when the vout argument is NULL.
*
* @warning To avoid deadlocks, users should never call vout_thread_t functions
* from these callbacks.
*/
struct vlc_player_vout_cbs
{
/**
* Called when the player and/or vout fullscreen state has changed
*
* @see vlc_player_vout_SetFullscreen()
*
* @param player unlocked player instance
* @param vout cf. vlc_player_vout_cbs note
* @param enabled true when fullscreen is enabled
* @param data opaque pointer set by vlc_player_vout_AddListener()
*/
void (*on_fullscreen_changed)(vlc_player_t *player,
vout_thread_t *vout, bool enabled, void *data);
/**
* Called when the player and/or vout wallpaper mode has changed
*
* @see vlc_player_vout_SetWallpaperModeEnabled()
*
* @param player unlocked player instance
* @param vout cf. vlc_player_vout_cbs note
* @param enabled true when wallpaper mode is enabled
* @param data opaque pointer set by vlc_player_vout_AddListener()
*/
void (*on_wallpaper_mode_changed)(vlc_player_t *player,
vout_thread_t *vout, bool enabled, void *data);
};
/**
* Player aout callbacks
*
* Can be registered with vlc_player_aout_AddListener().
*
* These callbacks are *not* called with the player locked. It is safe to lock
* the player and call any vlc_player functions from these callbacks.
*
* @warning To avoid deadlocks, users should never call audio_output_t
* functions from these callbacks.
*/
struct vlc_player_aout_cbs
{
/**
* Called when the volume has changed
*
* @see vlc_player_aout_SetVolume()
*
* @param player unlocked player instance
* @param new_volume volume in the range [0;2.f]
* @param data opaque pointer set by vlc_player_vout_AddListener()
*/
void (*on_volume_changed)(vlc_player_t *player,
float new_volume, void *data);
/**
* Called when the mute state has changed
*
* @see vlc_player_aout_Mute()
*
* @param player unlocked player instance
* @param new_mute true if muted
* @param data opaque pointer set by vlc_player_vout_AddListener()
*/
void (*on_mute_changed)(vlc_player_t *player,
bool new_muted, void *data);
};
/**
* Duplicate a track
*
* This function can be used to pass a track from a callback to an other
* context. The es_id will be held by the duplicated track.
*
* @see vlc_player_cbs.on_track_list_changed
*
* @return a duplicated track or NULL on allocation error
*/
VLC_API struct vlc_player_track *
vlc_player_track_Dup(const struct vlc_player_track *track);
/**
* Delete a duplicated track
*/
VLC_API void
vlc_player_track_Delete(struct vlc_player_track *track);
/**
* Duplicate a program
*
* This function can be used to pass a program from a callback to an other
* context.
*
* @see vlc_player_cbs.on_program_list_changed
*
* @return a duplicated program or NULL on allocation error
*/
VLC_API struct vlc_player_program *
vlc_player_program_Dup(const struct vlc_player_program *prgm);
/**
* Delete a duplicated program
*/
VLC_API void
vlc_player_program_Delete(struct vlc_player_program *prgm);
/**
* Hold the title list of the player
*
* This function can be used to pass this title list from a callback to an
* other thread.
*
* @see vlc_player_cbs.on_titles_changed
*
* @return the same instance
*/
VLC_API vlc_player_title_list *
vlc_player_title_list_Hold(vlc_player_title_list *titles);
/**
* Release of previously held title list
*/
VLC_API void
vlc_player_title_list_Release(vlc_player_title_list *titles);
/**
* Get the number of title of a list
*/
VLC_API size_t
vlc_player_title_list_GetCount(vlc_player_title_list *titles);
/**
* Get the title at a given index
*
* @param idx index in the range [0; count[
* @return a valid title (can't be NULL)
*/
VLC_API const struct vlc_player_title *
vlc_player_title_list_GetAt(vlc_player_title_list *titles, size_t idx);
/**
* Create a new player instance