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
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 struct content_source
{
51 struct stream
*stream
;
52 struct demuxer
*demuxer
;
55 struct timeline_part
{
58 struct content_source
*source
;
66 typedef struct MPContext
{
68 struct m_config
*mconfig
;
69 struct vo_x11_state
*x11_state
;
70 struct mp_fifo
*key_fifo
;
71 struct input_ctx
*input
;
72 struct osd_state
*osd
;
74 bool add_osd_seek_info
;
75 // if nonzero, hide current OSD contents when GetTimerMS() reaches this
76 unsigned int osd_show_percentage_until
;
77 unsigned int osd_visible
;
80 const ao_functions_t
*audio_out
;
81 struct play_tree
*playtree
;
82 struct play_tree_iter
*playtree_iter
;
83 char *filename
; // currently playing file
84 enum stop_play_reason stop_play
;
86 unsigned int initialized_flags
; // which subsystems have been initialized
88 struct content_source
*sources
;
90 struct timeline_part
*timeline
;
91 int num_timeline_parts
;
93 struct chapter
*chapters
;
97 struct stream
*stream
;
98 struct demuxer
*demuxer
;
99 struct sh_audio
*sh_audio
;
100 struct sh_video
*sh_video
;
101 struct demux_stream
*d_audio
;
102 struct demux_stream
*d_video
;
103 struct demux_stream
*d_sub
;
105 struct vo
*video_out
;
106 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
107 // This is really a vo variable but currently there's no suitable vo
109 int num_buffered_frames
;
111 // Show a video frame as quickly as possible without trying to adjust
112 // for AV sync. Used when starting a file or after seeking.
113 bool update_video_immediately
;
114 // AV sync: the next frame should be shown when the audio out has this
115 // much (in seconds) buffered data left. Increased when more data is
116 // written to the ao, decreased when moving to the next frame.
117 // In the audio-only case used as a timer since the last seek
118 // by the audio CPU usage meter.
120 // AV sync: time until next frame should be shown
122 // How long the last vo flip() call took. Used to adjust timing with
123 // the goal of making flip() calls finish (rather than start) at the
125 float last_vo_flip_duration
;
126 // How much video timing has been changed to make it match the audio
127 // timeline. Used for status line information only.
128 double total_avsync_change
;
129 // A-V sync difference when last frame was displayed. Kept to display
130 // the same value if the status line is updated at a time where no new
131 // video frame is shown.
132 double last_av_difference
;
134 // Timestamp from the last time some timing functions read the
135 // current time, in (occasionally wrapping) microseconds. Used
136 // to turn a new time value to a delta from last time.
137 unsigned int last_time
;
139 // Used to communicate the parameters of a seek between parts
140 double rel_seek_secs
;
143 float begin_skip
; ///< start time of the current skip while on edlout mode
144 // audio is muted if either EDL or user activates mute
145 short edl_muted
; ///< Stores whether EDL is currently in muted mode.
146 short user_muted
; ///< Stores whether user wanted muted mode.
148 int global_sub_size
; // this encompasses all subtitle sources
149 int global_sub_pos
; // this encompasses all subtitle sources
152 int global_sub_indices
[SUB_SOURCES
];
153 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
154 // parsed by libass or NULL if format unsupported
155 struct ass_track_s
*set_of_ass_tracks
[MAX_SUBTITLE_FILES
];
156 sub_data
* set_of_subtitles
[MAX_SUBTITLE_FILES
];
164 // step this many frames, then pause
167 // Set after showing warning about decoding being too slow for realtime
168 // playback rate. Used to avoid showing it multiple times.
169 bool drop_message_shown
;
172 struct mp_image
*nav_smpi
; ///< last decoded dvdnav video image
173 unsigned char *nav_buffer
; ///< last read dvdnav video frame
174 unsigned char *nav_start
; ///< pointer to last read video buffer
175 int nav_in_size
; ///< last read size
180 // Most of these should not be globals
182 extern int file_filter
;
183 // These appear in options list
184 extern int forced_subs_only
;
187 int build_afilter_chain(struct MPContext
*mpctx
, struct sh_audio
*sh_audio
, struct ao_data
*ao_data
);
188 void uninit_player(struct MPContext
*mpctx
, unsigned int mask
);
189 void reinit_audio_chain(struct MPContext
*mpctx
);
190 void init_vo_spudec(struct MPContext
*mpctx
);
191 double playing_audio_pts(struct MPContext
*mpctx
);
192 void exit_player_with_rc(struct MPContext
*mpctx
, exit_reason_t how
, int rc
);
193 void add_subtitles(struct MPContext
*mpctx
, char *filename
, float fps
, int noerr
);
194 int reinit_video_chain(struct MPContext
*mpctx
);
195 void pause_player(struct MPContext
*mpctx
);
196 void unpause_player(struct MPContext
*mpctx
);
197 void add_step_frame(struct MPContext
*mpctx
);
198 int seek_chapter(struct MPContext
*mpctx
, int chapter
, double *seek_pts
,
199 char **chapter_name
);
200 int get_current_chapter(struct MPContext
*mpctx
);
201 char *chapter_display_name(struct MPContext
*mpctx
, int chapter
);
203 #endif /* MPLAYER_MP_CORE_H */