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
23 #include "libao2/audio_out.h"
25 #include "stream/stream.h"
26 #include "libmpdemux/demuxer.h"
27 #include "libmpdemux/stheader.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
54 #define PT_NEXT_ENTRY 1
55 #define PT_PREV_ENTRY -1
57 #define PT_PREV_SRC -2
69 typedef struct MPContext
{
70 int osd_show_percentage
;
72 const ao_functions_t
*audio_out
;
73 play_tree_t
*playtree
;
74 play_tree_iter_t
*playtree_iter
;
83 demux_stream_t
*d_audio
;
84 demux_stream_t
*d_video
;
85 demux_stream_t
*d_sub
;
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
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
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.
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
114 int global_sub_indices
[SUB_SOURCES
];
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
];
120 sub_data
* set_of_subtitles
[MAX_SUBTITLE_FILES
];
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
140 // Most of these should not be globals
141 extern int abs_seek_pos
;
142 extern float rel_seek_secs
;
144 extern int file_filter
;
145 // These appear in options list
146 extern float playback_speed
;
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 */