Apply patch for oCERT #2008-013 / CVE-2008-3827
[mplayer/glamo.git] / mp_core.h
blob19cb5ff08c3fbe87c6a40f5f27856dfe270b3e3c
1 #ifndef MPLAYER_MP_CORE_H
2 #define MPLAYER_MP_CORE_H
4 #include "mp_osd.h"
5 #include "libao2/audio_out.h"
6 #include "playtree.h"
7 #include "stream/stream.h"
8 #include "libmpdemux/demuxer.h"
9 #include "libmpdemux/stheader.h"
10 #include "mixer.h"
11 #include "libvo/video_out.h"
12 #include "subreader.h"
14 // definitions used internally by the core player code
16 #define INITIALIZED_VO 1
17 #define INITIALIZED_AO 2
18 #define INITIALIZED_GUI 4
19 #define INITIALIZED_GETCH2 8
20 #define INITIALIZED_SPUDEC 32
21 #define INITIALIZED_STREAM 64
22 #define INITIALIZED_INPUT 128
23 #define INITIALIZED_VOBSUB 256
24 #define INITIALIZED_DEMUXER 512
25 #define INITIALIZED_ACODEC 1024
26 #define INITIALIZED_VCODEC 2048
27 #define INITIALIZED_ALL 0xFFFF
30 #define SUB_SOURCE_SUBS 0
31 #define SUB_SOURCE_VOBSUB 1
32 #define SUB_SOURCE_DEMUX 2
33 #define SUB_SOURCES 3
36 #define PT_NEXT_ENTRY 1
37 #define PT_PREV_ENTRY -1
38 #define PT_NEXT_SRC 2
39 #define PT_PREV_SRC -2
40 #define PT_UP_NEXT 3
41 #define PT_UP_PREV -3
42 #define PT_STOP 4
45 typedef struct MPContext {
46 int osd_show_percentage;
47 int osd_function;
48 const ao_functions_t *audio_out;
49 play_tree_t *playtree;
50 play_tree_iter_t *playtree_iter;
51 int eof;
52 int play_tree_step;
53 int loop_times;
55 stream_t *stream;
56 demuxer_t *demuxer;
57 sh_audio_t *sh_audio;
58 sh_video_t *sh_video;
59 demux_stream_t *d_audio;
60 demux_stream_t *d_video;
61 demux_stream_t *d_sub;
62 mixer_t mixer;
63 const vo_functions_t *video_out;
64 // Frames buffered in the vo ready to flip. Currently always 0 or 1.
65 // This is really a vo variable but currently there's no suitable vo
66 // struct.
67 int num_buffered_frames;
69 // AV sync: the next frame should be shown when the audio out has this
70 // much (in seconds) buffered data left. Increased when more data is
71 // written to the ao, decreased when moving to the next frame.
72 // In the audio-only case used as a timer since the last seek
73 // by the audio CPU usage meter.
74 double delay;
76 float begin_skip; ///< start time of the current skip while on edlout mode
77 // audio is muted if either EDL or user activates mute
78 short edl_muted; ///< Stores whether EDL is currently in muted mode.
79 short user_muted; ///< Stores whether user wanted muted mode.
81 int global_sub_size; // this encompasses all subtitle sources
82 int global_sub_pos; // this encompasses all subtitle sources
83 int set_of_sub_pos;
84 int set_of_sub_size;
85 int global_sub_indices[SUB_SOURCES];
86 #ifdef CONFIG_ASS
87 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
88 // parsed by libass or NULL if format unsupported
89 ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
90 #endif
91 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
93 int file_format;
95 #ifdef CONFIG_DVBIN
96 int last_dvb_step;
97 int dvbin_reopen;
98 #endif
100 int was_paused;
102 #ifdef CONFIG_DVDNAV
103 struct mp_image_s *nav_smpi; ///< last decoded dvdnav video image
104 unsigned char *nav_buffer; ///< last read dvdnav video frame
105 unsigned char *nav_start; ///< pointer to last read video buffer
106 int nav_in_size; ///< last read size
107 #endif
108 } MPContext;
111 // Most of these should not be globals
112 extern int abs_seek_pos;
113 extern float rel_seek_secs;
114 extern FILE *edl_fd;
115 extern int file_filter;
116 // These appear in options list
117 extern float playback_speed;
118 extern int fixed_vo;
119 extern int forced_subs_only;
122 int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data);
123 void uninit_player(unsigned int mask);
124 void reinit_audio_chain(void);
125 void init_vo_spudec(void);
126 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
127 const ao_functions_t *audio_out);
128 void exit_player_with_rc(const char* how, int rc);
129 void add_subtitles(char *filename, float fps, int noerr);
130 int reinit_video_chain(void);
132 #endif /* MPLAYER_MP_CORE_H */