1 #ifndef MPLAYER_MP_CORE_H
2 #define MPLAYER_MP_CORE_H
10 // definitions used internally by the core player code
12 #define INITIALIZED_VO 1
13 #define INITIALIZED_AO 2
14 #define INITIALIZED_GUI 4
15 #define INITIALIZED_GETCH2 8
16 #define INITIALIZED_SPUDEC 32
17 #define INITIALIZED_STREAM 64
18 #define INITIALIZED_VOBSUB 256
19 #define INITIALIZED_DEMUXER 512
20 #define INITIALIZED_ACODEC 1024
21 #define INITIALIZED_VCODEC 2048
22 #define INITIALIZED_ALL 0xFFFF
25 #define SUB_SOURCE_SUBS 0
26 #define SUB_SOURCE_VOBSUB 1
27 #define SUB_SOURCE_DEMUX 2
31 enum stop_play_reason
{
32 KEEP_PLAYING
= 0, // must be 0, numeric values of others do not matter
50 typedef struct MPContext
{
52 struct m_config
*mconfig
;
53 struct vo_x11_state
*x11_state
;
54 struct mp_fifo
*key_fifo
;
55 struct input_ctx
*input
;
56 struct osd_state
*osd
;
58 bool add_osd_seek_info
;
59 // if nonzero, hide current OSD contents when GetTimerMS() reaches this
60 unsigned int osd_show_percentage_until
;
61 unsigned int osd_visible
;
64 const ao_functions_t
*audio_out
;
65 struct play_tree
*playtree
;
66 struct play_tree_iter
*playtree_iter
;
67 char *filename
; // currently playing file
68 enum stop_play_reason stop_play
;
70 unsigned int initialized_flags
; // which subsystems have been initialized
72 struct stream
*stream
;
73 struct demuxer
*demuxer
;
74 struct sh_audio
*sh_audio
;
75 struct sh_video
*sh_video
;
76 struct demux_stream
*d_audio
;
77 struct demux_stream
*d_video
;
78 struct demux_stream
*d_sub
;
81 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
82 // This is really a vo variable but currently there's no suitable vo
84 int num_buffered_frames
;
86 // Show a video frame as quickly as possible without trying to adjust
87 // for AV sync. Used when starting a file or after seeking.
88 bool update_video_immediately
;
89 // AV sync: the next frame should be shown when the audio out has this
90 // much (in seconds) buffered data left. Increased when more data is
91 // written to the ao, decreased when moving to the next frame.
92 // In the audio-only case used as a timer since the last seek
93 // by the audio CPU usage meter.
95 // AV sync: time until next frame should be shown
97 // How long the last vo flip() call took. Used to adjust timing with
98 // the goal of making flip() calls finish (rather than start) at the
100 float last_vo_flip_duration
;
101 // How much video timing has been changed to make it match the audio
102 // timeline. Used for status line information only.
103 double total_avsync_change
;
104 // A-V sync difference when last frame was displayed. Kept to display
105 // the same value if the status line is updated at a time where no new
106 // video frame is shown.
107 double last_av_difference
;
109 // Timestamp from the last time some timing functions read the
110 // current time, in (occasionally wrapping) microseconds. Used
111 // to turn a new time value to a delta from last time.
112 unsigned int last_time
;
114 // Used to communicate the parameters of a seek between parts
118 float begin_skip
; ///< start time of the current skip while on edlout mode
119 // audio is muted if either EDL or user activates mute
120 short edl_muted
; ///< Stores whether EDL is currently in muted mode.
121 short user_muted
; ///< Stores whether user wanted muted mode.
123 int global_sub_size
; // this encompasses all subtitle sources
124 int global_sub_pos
; // this encompasses all subtitle sources
127 int global_sub_indices
[SUB_SOURCES
];
128 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
129 // parsed by libass or NULL if format unsupported
130 struct ass_track_s
*set_of_ass_tracks
[MAX_SUBTITLE_FILES
];
131 sub_data
* set_of_subtitles
[MAX_SUBTITLE_FILES
];
139 // step this many frames, then pause
142 // Set after showing warning about decoding being too slow for realtime
143 // playback rate. Used to avoid showing it multiple times.
144 bool drop_message_shown
;
147 struct mp_image
*nav_smpi
; ///< last decoded dvdnav video image
148 unsigned char *nav_buffer
; ///< last read dvdnav video frame
149 unsigned char *nav_start
; ///< pointer to last read video buffer
150 int nav_in_size
; ///< last read size
155 // Most of these should not be globals
157 extern int file_filter
;
158 // These appear in options list
159 extern int forced_subs_only
;
162 int build_afilter_chain(struct MPContext
*mpctx
, struct sh_audio
*sh_audio
, struct ao_data
*ao_data
);
163 void uninit_player(struct MPContext
*mpctx
, unsigned int mask
);
164 void reinit_audio_chain(struct MPContext
*mpctx
);
165 void init_vo_spudec(struct MPContext
*mpctx
);
166 double playing_audio_pts(struct MPContext
*mpctx
);
167 void exit_player_with_rc(struct MPContext
*mpctx
, exit_reason_t how
, int rc
);
168 void add_subtitles(struct MPContext
*mpctx
, char *filename
, float fps
, int noerr
);
169 int reinit_video_chain(struct MPContext
*mpctx
);
170 void pause_player(struct MPContext
*mpctx
);
171 void unpause_player(struct MPContext
*mpctx
);
172 void add_step_frame(struct MPContext
*mpctx
);
174 #endif /* MPLAYER_MP_CORE_H */