Fix compilation after r31173.
[mplayer/glamo.git] / mp_core.h
blob026628af2f7946c17c2db2a81583d0e381ad5a60
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_MP_CORE_H
20 #define MPLAYER_MP_CORE_H
22 #include "mp_osd.h"
23 #include "libao2/audio_out.h"
24 #include "playtree.h"
25 #include "stream/stream.h"
26 #include "libmpdemux/demuxer.h"
27 #include "libmpdemux/stheader.h"
28 #include "mixer.h"
29 #include "libvo/video_out.h"
30 #include "subreader.h"
32 // definitions used internally by the core player code
34 #define INITIALIZED_VO 1
35 #define INITIALIZED_AO 2
36 #define INITIALIZED_GUI 4
37 #define INITIALIZED_GETCH2 8
38 #define INITIALIZED_SPUDEC 32
39 #define INITIALIZED_STREAM 64
40 #define INITIALIZED_INPUT 128
41 #define INITIALIZED_VOBSUB 256
42 #define INITIALIZED_DEMUXER 512
43 #define INITIALIZED_ACODEC 1024
44 #define INITIALIZED_VCODEC 2048
45 #define INITIALIZED_ALL 0xFFFF
48 #define SUB_SOURCE_SUBS 0
49 #define SUB_SOURCE_VOBSUB 1
50 #define SUB_SOURCE_DEMUX 2
51 #define SUB_SOURCES 3
54 #define PT_NEXT_ENTRY 1
55 #define PT_PREV_ENTRY -1
56 #define PT_NEXT_SRC 2
57 #define PT_PREV_SRC -2
58 #define PT_UP_NEXT 3
59 #define PT_UP_PREV -3
60 #define PT_STOP 4
62 enum exit_reason {
63 EXIT_NONE,
64 EXIT_QUIT,
65 EXIT_EOF,
66 EXIT_ERROR
69 typedef struct MPContext {
70 int osd_show_percentage;
71 int osd_function;
72 const ao_functions_t *audio_out;
73 play_tree_t *playtree;
74 play_tree_iter_t *playtree_iter;
75 int eof;
76 int play_tree_step;
77 int loop_times;
79 stream_t *stream;
80 demuxer_t *demuxer;
81 sh_audio_t *sh_audio;
82 sh_video_t *sh_video;
83 demux_stream_t *d_audio;
84 demux_stream_t *d_video;
85 demux_stream_t *d_sub;
86 mixer_t mixer;
87 const vo_functions_t *video_out;
88 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
89 // This is really a vo variable but currently there's no suitable vo
90 // struct.
91 int num_buffered_frames;
93 // used to retry decoding after startup/seeking to compensate for codec delay
94 int startup_decode_retry;
95 // how long until we need to display the "current" frame
96 float time_frame;
98 // AV sync: the next frame should be shown when the audio out has this
99 // much (in seconds) buffered data left. Increased when more data is
100 // written to the ao, decreased when moving to the next frame.
101 // In the audio-only case used as a timer since the last seek
102 // by the audio CPU usage meter.
103 double delay;
105 float begin_skip; ///< start time of the current skip while on edlout mode
106 // audio is muted if either EDL or user activates mute
107 short edl_muted; ///< Stores whether EDL is currently in muted mode.
108 short user_muted; ///< Stores whether user wanted muted mode.
110 int global_sub_size; // this encompasses all subtitle sources
111 int global_sub_pos; // this encompasses all subtitle sources
112 int set_of_sub_pos;
113 int set_of_sub_size;
114 int global_sub_indices[SUB_SOURCES];
115 #ifdef CONFIG_ASS
116 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
117 // parsed by libass or NULL if format unsupported
118 ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
119 #endif
120 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
122 int file_format;
124 #ifdef CONFIG_DVBIN
125 int last_dvb_step;
126 int dvbin_reopen;
127 #endif
129 int was_paused;
131 #ifdef CONFIG_DVDNAV
132 struct mp_image_s *nav_smpi; ///< last decoded dvdnav video image
133 unsigned char *nav_buffer; ///< last read dvdnav video frame
134 unsigned char *nav_start; ///< pointer to last read video buffer
135 int nav_in_size; ///< last read size
136 #endif
137 } MPContext;
140 // Most of these should not be globals
141 extern int abs_seek_pos;
142 extern float rel_seek_secs;
143 extern FILE *edl_fd;
144 extern int file_filter;
145 // These appear in options list
146 extern float playback_speed;
147 extern int fixed_vo;
148 extern int forced_subs_only;
151 int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data);
152 void uninit_player(unsigned int mask);
153 void reinit_audio_chain(void);
154 void init_vo_spudec(void);
155 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
156 const ao_functions_t *audio_out);
157 void exit_player(enum exit_reason how);
158 void exit_player_with_rc(enum exit_reason how, int rc);
159 void add_subtitles(char *filename, float fps, int noerr);
160 int reinit_video_chain(void);
162 #endif /* MPLAYER_MP_CORE_H */