Update OSD while paused
[mplayer/glamo.git] / mp_core.h
bloba346c75dcefab2682fe6fd7413b34447e3cb0fc0
1 #ifndef MPLAYER_MP_CORE_H
2 #define MPLAYER_MP_CORE_H
4 #include "options.h"
5 #include "mixer.h"
6 #include "subreader.h"
8 // definitions used internally by the core player code
10 #define INITIALIZED_VO 1
11 #define INITIALIZED_AO 2
12 #define INITIALIZED_GUI 4
13 #define INITIALIZED_GETCH2 8
14 #define INITIALIZED_SPUDEC 32
15 #define INITIALIZED_STREAM 64
16 #define INITIALIZED_VOBSUB 256
17 #define INITIALIZED_DEMUXER 512
18 #define INITIALIZED_ACODEC 1024
19 #define INITIALIZED_VCODEC 2048
20 #define INITIALIZED_ALL 0xFFFF
23 #define SUB_SOURCE_SUBS 0
24 #define SUB_SOURCE_VOBSUB 1
25 #define SUB_SOURCE_DEMUX 2
26 #define SUB_SOURCES 3
29 enum stop_play_reason {
30 KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
31 AT_END_OF_FILE,
32 PT_NEXT_ENTRY,
33 PT_PREV_ENTRY,
34 PT_NEXT_SRC,
35 PT_PREV_SRC,
36 PT_UP_NEXT,
37 PT_UP_PREV,
38 PT_STOP,
41 typedef enum {
42 EXIT_NONE,
43 EXIT_QUIT,
44 EXIT_EOF,
45 EXIT_ERROR
46 } exit_reason_t;
48 typedef struct MPContext {
49 struct MPOpts opts;
50 struct m_config *mconfig;
51 struct vo_x11_state *x11_state;
52 struct mp_fifo *key_fifo;
53 struct input_ctx *input;
54 struct osd_state *osd;
55 int osd_show_percentage;
56 int osd_function;
57 const ao_functions_t *audio_out;
58 struct play_tree *playtree;
59 struct play_tree_iter *playtree_iter;
60 char *filename; // currently playing file
61 enum stop_play_reason stop_play;
62 int play_tree_step;
63 unsigned int initialized_flags; // which subsystems have been initialized
65 struct stream *stream;
66 struct demuxer *demuxer;
67 struct sh_audio *sh_audio;
68 struct sh_video *sh_video;
69 struct demux_stream *d_audio;
70 struct demux_stream *d_video;
71 struct demux_stream *d_sub;
72 mixer_t mixer;
73 struct vo *video_out;
74 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
75 // This is really a vo variable but currently there's no suitable vo
76 // struct.
77 int num_buffered_frames;
79 // AV sync: the next frame should be shown when the audio out has this
80 // much (in seconds) buffered data left. Increased when more data is
81 // written to the ao, decreased when moving to the next frame.
82 // In the audio-only case used as a timer since the last seek
83 // by the audio CPU usage meter.
84 double delay;
85 // AV sync: time until next frame should be shown
86 float time_frame;
88 // Timestamp from the last time some timing functions read the
89 // current time, in (occasionally wrapping) microseconds. Used
90 // to turn a new time value to a delta from last time.
91 unsigned int last_time;
93 // Used to communicate the parameters of a seek between parts
94 float rel_seek_secs;
95 int abs_seek_pos;
97 float begin_skip; ///< start time of the current skip while on edlout mode
98 // audio is muted if either EDL or user activates mute
99 short edl_muted; ///< Stores whether EDL is currently in muted mode.
100 short user_muted; ///< Stores whether user wanted muted mode.
102 int global_sub_size; // this encompasses all subtitle sources
103 int global_sub_pos; // this encompasses all subtitle sources
104 int set_of_sub_pos;
105 int set_of_sub_size;
106 int global_sub_indices[SUB_SOURCES];
107 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
108 // parsed by libass or NULL if format unsupported
109 struct ass_track_s *set_of_ass_tracks[MAX_SUBTITLE_FILES];
110 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
112 int file_format;
114 int last_dvb_step;
115 int dvbin_reopen;
117 int paused;
118 // step this many frames, then pause
119 int step_frames;
121 #ifdef CONFIG_DVDNAV
122 struct mp_image *nav_smpi; ///< last decoded dvdnav video image
123 unsigned char *nav_buffer; ///< last read dvdnav video frame
124 unsigned char *nav_start; ///< pointer to last read video buffer
125 int nav_in_size; ///< last read size
126 #endif
127 } MPContext;
130 // Most of these should not be globals
131 extern FILE *edl_fd;
132 extern int file_filter;
133 // These appear in options list
134 extern int forced_subs_only;
136 struct ao_data;
137 int build_afilter_chain(struct MPContext *mpctx, struct sh_audio *sh_audio, struct ao_data *ao_data);
138 void uninit_player(struct MPContext *mpctx, unsigned int mask);
139 void reinit_audio_chain(struct MPContext *mpctx);
140 void init_vo_spudec(struct MPContext *mpctx);
141 double playing_audio_pts(struct MPContext *mpctx);
142 void exit_player_with_rc(struct MPContext *mpctx, exit_reason_t how, int rc);
143 void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr);
144 int reinit_video_chain(struct MPContext *mpctx);
145 void pause_player(struct MPContext *mpctx);
146 void unpause_player(struct MPContext *mpctx);
147 void add_step_frame(struct MPContext *mpctx);
149 #endif /* MPLAYER_MP_CORE_H */