Merge svn changes up to r28065
[mplayer.git] / mp_core.h
bloba396c53ad99ac61f8c90b9df431011b07afa2b37
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,
42 typedef struct MPContext {
43 struct MPOpts opts;
44 struct m_config *mconfig;
45 struct vo_x11_state *x11_state;
46 struct mp_fifo *key_fifo;
47 struct input_ctx *input;
48 struct osd_state *osd;
49 int osd_show_percentage;
50 int osd_function;
51 const ao_functions_t *audio_out;
52 struct play_tree *playtree;
53 struct play_tree_iter *playtree_iter;
54 char *filename; // currently playing file
55 enum stop_play_reason stop_play;
56 int play_tree_step;
57 unsigned int initialized_flags; // which subsystems have been initialized
59 struct stream *stream;
60 struct demuxer *demuxer;
61 struct sh_audio *sh_audio;
62 struct sh_video *sh_video;
63 struct demux_stream *d_audio;
64 struct demux_stream *d_video;
65 struct demux_stream *d_sub;
66 mixer_t mixer;
67 struct vo *video_out;
68 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
69 // This is really a vo variable but currently there's no suitable vo
70 // struct.
71 int num_buffered_frames;
73 // AV sync: the next frame should be shown when the audio out has this
74 // much (in seconds) buffered data left. Increased when more data is
75 // written to the ao, decreased when moving to the next frame.
76 // In the audio-only case used as a timer since the last seek
77 // by the audio CPU usage meter.
78 double delay;
80 // Timestamp from the last time some timing functions read the
81 // current time, in (occasionally wrapping) microseconds. Used
82 // to turn a new time value to a delta from last time.
83 unsigned int last_time;
85 // Used to communicate the parameters of a seek between parts
86 float rel_seek_secs;
87 int abs_seek_pos;
89 float begin_skip; ///< start time of the current skip while on edlout mode
90 // audio is muted if either EDL or user activates mute
91 short edl_muted; ///< Stores whether EDL is currently in muted mode.
92 short user_muted; ///< Stores whether user wanted muted mode.
94 int global_sub_size; // this encompasses all subtitle sources
95 int global_sub_pos; // this encompasses all subtitle sources
96 int set_of_sub_pos;
97 int set_of_sub_size;
98 int global_sub_indices[SUB_SOURCES];
99 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
100 // parsed by libass or NULL if format unsupported
101 struct ass_track_s *set_of_ass_tracks[MAX_SUBTITLE_FILES];
102 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
104 int file_format;
106 int last_dvb_step;
107 int dvbin_reopen;
109 int was_paused;
111 #ifdef CONFIG_DVDNAV
112 struct mp_image *nav_smpi; ///< last decoded dvdnav video image
113 unsigned char *nav_buffer; ///< last read dvdnav video frame
114 unsigned char *nav_start; ///< pointer to last read video buffer
115 int nav_in_size; ///< last read size
116 #endif
117 } MPContext;
120 // Most of these should not be globals
121 extern FILE *edl_fd;
122 extern int file_filter;
123 // These appear in options list
124 extern int forced_subs_only;
126 struct ao_data;
127 int build_afilter_chain(struct MPContext *mpctx, struct sh_audio *sh_audio, struct ao_data *ao_data);
128 void uninit_player(struct MPContext *mpctx, unsigned int mask);
129 void reinit_audio_chain(struct MPContext *mpctx);
130 void init_vo_spudec(struct MPContext *mpctx);
131 double playing_audio_pts(struct MPContext *mpctx);
132 void exit_player_with_rc(struct MPContext *mpctx, const char* how, int rc);
133 void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr);
134 int reinit_video_chain(struct MPContext *mpctx);
136 #endif /* MPLAYER_MP_CORE_H */