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
;
57 int osd_show_percentage
;
59 const ao_functions_t
*audio_out
;
60 struct play_tree
*playtree
;
61 struct play_tree_iter
*playtree_iter
;
62 char *filename
; // currently playing file
63 enum stop_play_reason stop_play
;
65 unsigned int initialized_flags
; // which subsystems have been initialized
67 struct stream
*stream
;
68 struct demuxer
*demuxer
;
69 struct sh_audio
*sh_audio
;
70 struct sh_video
*sh_video
;
71 struct demux_stream
*d_audio
;
72 struct demux_stream
*d_video
;
73 struct demux_stream
*d_sub
;
76 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
77 // This is really a vo variable but currently there's no suitable vo
79 int num_buffered_frames
;
81 // Show a video frame as quickly as possible without trying to adjust
82 // for AV sync. Used when starting a file or after seeking.
83 bool update_video_immediately
;
84 // AV sync: the next frame should be shown when the audio out has this
85 // much (in seconds) buffered data left. Increased when more data is
86 // written to the ao, decreased when moving to the next frame.
87 // In the audio-only case used as a timer since the last seek
88 // by the audio CPU usage meter.
90 // AV sync: time until next frame should be shown
92 // How long the last vo flip() call took. Used to adjust timing with
93 // the goal of making flip() calls finish (rather than start) at the
95 float last_vo_flip_duration
;
96 // How much video timing has been changed to make it match the audio
97 // timeline. Used for status line information only.
98 double total_avsync_change
;
99 // A-V sync difference when last frame was displayed. Kept to display
100 // the same value if the status line is updated at a time where no new
101 // video frame is shown.
102 double last_av_difference
;
104 // Timestamp from the last time some timing functions read the
105 // current time, in (occasionally wrapping) microseconds. Used
106 // to turn a new time value to a delta from last time.
107 unsigned int last_time
;
109 // Used to communicate the parameters of a seek between parts
113 float begin_skip
; ///< start time of the current skip while on edlout mode
114 // audio is muted if either EDL or user activates mute
115 short edl_muted
; ///< Stores whether EDL is currently in muted mode.
116 short user_muted
; ///< Stores whether user wanted muted mode.
118 int global_sub_size
; // this encompasses all subtitle sources
119 int global_sub_pos
; // this encompasses all subtitle sources
122 int global_sub_indices
[SUB_SOURCES
];
123 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
124 // parsed by libass or NULL if format unsupported
125 struct ass_track_s
*set_of_ass_tracks
[MAX_SUBTITLE_FILES
];
126 sub_data
* set_of_subtitles
[MAX_SUBTITLE_FILES
];
134 // step this many frames, then pause
137 // Set after showing warning about decoding being too slow for realtime
138 // playback rate. Used to avoid showing it multiple times.
139 bool drop_message_shown
;
142 struct mp_image
*nav_smpi
; ///< last decoded dvdnav video image
143 unsigned char *nav_buffer
; ///< last read dvdnav video frame
144 unsigned char *nav_start
; ///< pointer to last read video buffer
145 int nav_in_size
; ///< last read size
150 // Most of these should not be globals
152 extern int file_filter
;
153 // These appear in options list
154 extern int forced_subs_only
;
157 int build_afilter_chain(struct MPContext
*mpctx
, struct sh_audio
*sh_audio
, struct ao_data
*ao_data
);
158 void uninit_player(struct MPContext
*mpctx
, unsigned int mask
);
159 void reinit_audio_chain(struct MPContext
*mpctx
);
160 void init_vo_spudec(struct MPContext
*mpctx
);
161 double playing_audio_pts(struct MPContext
*mpctx
);
162 void exit_player_with_rc(struct MPContext
*mpctx
, exit_reason_t how
, int rc
);
163 void add_subtitles(struct MPContext
*mpctx
, char *filename
, float fps
, int noerr
);
164 int reinit_video_chain(struct MPContext
*mpctx
);
165 void pause_player(struct MPContext
*mpctx
);
166 void unpause_player(struct MPContext
*mpctx
);
167 void add_step_frame(struct MPContext
*mpctx
);
169 #endif /* MPLAYER_MP_CORE_H */