Implement VFCAP_FLIP for vo_vdpau.
[mplayer.git] / mp_core.h
blob2fa98e57d4e975ecd1bf0a49756c7f293024c5d6
1 #ifndef MPLAYER_MP_CORE_H
2 #define MPLAYER_MP_CORE_H
4 #include "mp_osd.h"
5 #include "libao2/audio_out.h"
6 #include "playtree.h"
7 #include "stream/stream.h"
8 #include "libmpdemux/demuxer.h"
9 #include "libmpdemux/stheader.h"
10 #include "mixer.h"
11 #include "libvo/video_out.h"
12 #include "subreader.h"
14 // definitions used internally by the core player code
16 #define INITIALIZED_VO 1
17 #define INITIALIZED_AO 2
18 #define INITIALIZED_GUI 4
19 #define INITIALIZED_GETCH2 8
20 #define INITIALIZED_SPUDEC 32
21 #define INITIALIZED_STREAM 64
22 #define INITIALIZED_INPUT 128
23 #define INITIALIZED_VOBSUB 256
24 #define INITIALIZED_DEMUXER 512
25 #define INITIALIZED_ACODEC 1024
26 #define INITIALIZED_VCODEC 2048
27 #define INITIALIZED_ALL 0xFFFF
30 #define SUB_SOURCE_SUBS 0
31 #define SUB_SOURCE_VOBSUB 1
32 #define SUB_SOURCE_DEMUX 2
33 #define SUB_SOURCES 3
36 #define PT_NEXT_ENTRY 1
37 #define PT_PREV_ENTRY -1
38 #define PT_NEXT_SRC 2
39 #define PT_PREV_SRC -2
40 #define PT_UP_NEXT 3
41 #define PT_UP_PREV -3
42 #define PT_STOP 4
44 typedef enum {
45 EXIT_NONE,
46 EXIT_QUIT,
47 EXIT_EOF,
48 EXIT_ERROR
49 } exit_reason_t;
51 typedef struct MPContext {
52 int osd_show_percentage;
53 int osd_function;
54 const ao_functions_t *audio_out;
55 play_tree_t *playtree;
56 play_tree_iter_t *playtree_iter;
57 int eof;
58 int play_tree_step;
59 int loop_times;
61 stream_t *stream;
62 demuxer_t *demuxer;
63 sh_audio_t *sh_audio;
64 sh_video_t *sh_video;
65 demux_stream_t *d_audio;
66 demux_stream_t *d_video;
67 demux_stream_t *d_sub;
68 mixer_t mixer;
69 const vo_functions_t *video_out;
70 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
71 // This is really a vo variable but currently there's no suitable vo
72 // struct.
73 int num_buffered_frames;
75 // AV sync: the next frame should be shown when the audio out has this
76 // much (in seconds) buffered data left. Increased when more data is
77 // written to the ao, decreased when moving to the next frame.
78 // In the audio-only case used as a timer since the last seek
79 // by the audio CPU usage meter.
80 double delay;
82 float begin_skip; ///< start time of the current skip while on edlout mode
83 // audio is muted if either EDL or user activates mute
84 short edl_muted; ///< Stores whether EDL is currently in muted mode.
85 short user_muted; ///< Stores whether user wanted muted mode.
87 int global_sub_size; // this encompasses all subtitle sources
88 int global_sub_pos; // this encompasses all subtitle sources
89 int set_of_sub_pos;
90 int set_of_sub_size;
91 int global_sub_indices[SUB_SOURCES];
92 #ifdef CONFIG_ASS
93 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
94 // parsed by libass or NULL if format unsupported
95 ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
96 #endif
97 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
99 int file_format;
101 #ifdef CONFIG_DVBIN
102 int last_dvb_step;
103 int dvbin_reopen;
104 #endif
106 int was_paused;
108 #ifdef CONFIG_DVDNAV
109 struct mp_image_s *nav_smpi; ///< last decoded dvdnav video image
110 unsigned char *nav_buffer; ///< last read dvdnav video frame
111 unsigned char *nav_start; ///< pointer to last read video buffer
112 int nav_in_size; ///< last read size
113 #endif
114 } MPContext;
117 // Most of these should not be globals
118 extern int abs_seek_pos;
119 extern float rel_seek_secs;
120 extern FILE *edl_fd;
121 extern int file_filter;
122 // These appear in options list
123 extern float playback_speed;
124 extern int fixed_vo;
125 extern int forced_subs_only;
128 int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data);
129 void uninit_player(unsigned int mask);
130 void reinit_audio_chain(void);
131 void init_vo_spudec(void);
132 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
133 const ao_functions_t *audio_out);
134 void exit_player_with_rc(exit_reason_t how, int rc);
135 void add_subtitles(char *filename, float fps, int noerr);
136 int reinit_video_chain(void);
138 #endif /* MPLAYER_MP_CORE_H */