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