Mercurial > mplayer.hg
annotate mp_core.h @ 32102:52f920e9c540
Replace malloc+memset by calloc.
author | reimar |
---|---|
date | Sun, 12 Sep 2010 12:32:28 +0000 |
parents | 6332e41e13b3 |
children | 69d3be4d52a2 |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
17 */ |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30176
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_MP_CORE_H |
20 #define MPLAYER_MP_CORE_H | |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25264
diff
changeset
|
21 |
32084 | 22 #include "config.h" |
25899
9d4121fa508a
Split osd related stuff from mp_core.h into new header file mp_osd.h.
ulion
parents:
25824
diff
changeset
|
23 #include "mp_osd.h" |
26131
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
24 #include "libao2/audio_out.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
25 #include "playtree.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
26 #include "stream/stream.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
27 #include "libmpdemux/demuxer.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
28 #include "libmpdemux/stheader.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
29 #include "mixer.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
30 #include "libvo/video_out.h" |
83c95bd31aab
Add necessary #includes to pass 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
31 #include "subreader.h" |
25899
9d4121fa508a
Split osd related stuff from mp_core.h into new header file mp_osd.h.
ulion
parents:
25824
diff
changeset
|
32 |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
33 // definitions used internally by the core player code |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
34 |
25962 | 35 #define INITIALIZED_VO 1 |
36 #define INITIALIZED_AO 2 | |
37 #define INITIALIZED_GUI 4 | |
38 #define INITIALIZED_GETCH2 8 | |
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 | |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
46 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
47 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
48 #define SUB_SOURCE_SUBS 0 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
49 #define SUB_SOURCE_VOBSUB 1 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
50 #define SUB_SOURCE_DEMUX 2 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
51 #define SUB_SOURCES 3 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
52 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
53 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
54 #define PT_NEXT_ENTRY 1 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
55 #define PT_PREV_ENTRY -1 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
56 #define PT_NEXT_SRC 2 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
57 #define PT_PREV_SRC -2 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
58 #define PT_UP_NEXT 3 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
59 #define PT_UP_PREV -3 |
26877 | 60 #define PT_STOP 4 |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
61 |
30518
654cad7ea876
Rename exit_reason_t enum to exit_reason and do not typedef it.
diego
parents:
30516
diff
changeset
|
62 enum exit_reason { |
28032
92e770f6e890
Print ID_EXIT and exit reason message in identify mode when exiting.
reimar
parents:
27370
diff
changeset
|
63 EXIT_NONE, |
92e770f6e890
Print ID_EXIT and exit reason message in identify mode when exiting.
reimar
parents:
27370
diff
changeset
|
64 EXIT_QUIT, |
92e770f6e890
Print ID_EXIT and exit reason message in identify mode when exiting.
reimar
parents:
27370
diff
changeset
|
65 EXIT_EOF, |
92e770f6e890
Print ID_EXIT and exit reason message in identify mode when exiting.
reimar
parents:
27370
diff
changeset
|
66 EXIT_ERROR |
30518
654cad7ea876
Rename exit_reason_t enum to exit_reason and do not typedef it.
diego
parents:
30516
diff
changeset
|
67 }; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
68 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
69 typedef struct MPContext { |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
70 int osd_show_percentage; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
71 int osd_function; |
25913 | 72 const ao_functions_t *audio_out; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
73 play_tree_t *playtree; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
74 play_tree_iter_t *playtree_iter; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
75 int eof; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
76 int play_tree_step; |
23726 | 77 int loop_times; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
78 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
79 stream_t *stream; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
80 demuxer_t *demuxer; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
81 sh_audio_t *sh_audio; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
82 sh_video_t *sh_video; |
22297 | 83 demux_stream_t *d_audio; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
84 demux_stream_t *d_video; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
85 demux_stream_t *d_sub; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
86 mixer_t mixer; |
25219
e82ecde2cbd4
Mark several uses of vo_functions_t as const to stop some of the current
reimar
parents:
24242
diff
changeset
|
87 const vo_functions_t *video_out; |
22288
da8ba4c0fc57
Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents:
22280
diff
changeset
|
88 // Frames buffered in the vo ready to flip. Currently always 0 or 1. |
da8ba4c0fc57
Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents:
22280
diff
changeset
|
89 // This is really a vo variable but currently there's no suitable vo |
da8ba4c0fc57
Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents:
22280
diff
changeset
|
90 // struct. |
da8ba4c0fc57
Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents:
22280
diff
changeset
|
91 int num_buffered_frames; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
92 |
30176
6fb92182aff3
At startup and while seeking avoid to introduce pointless sleeps and possibly
reimar
parents:
30175
diff
changeset
|
93 // used to retry decoding after startup/seeking to compensate for codec delay |
6fb92182aff3
At startup and while seeking avoid to introduce pointless sleeps and possibly
reimar
parents:
30175
diff
changeset
|
94 int startup_decode_retry; |
30175
b7bb4a899a6b
Also reset time_frame and next_frame_time on reset, it makes no sense to
reimar
parents:
28032
diff
changeset
|
95 // how long until we need to display the "current" frame |
b7bb4a899a6b
Also reset time_frame and next_frame_time on reset, it makes no sense to
reimar
parents:
28032
diff
changeset
|
96 float time_frame; |
31971 | 97 // flag to indicate that we've found a correctly timed video frame PTS |
98 int framestep_found; | |
30175
b7bb4a899a6b
Also reset time_frame and next_frame_time on reset, it makes no sense to
reimar
parents:
28032
diff
changeset
|
99 |
22488 | 100 // AV sync: the next frame should be shown when the audio out has this |
101 // much (in seconds) buffered data left. Increased when more data is | |
102 // written to the ao, decreased when moving to the next frame. | |
103 // In the audio-only case used as a timer since the last seek | |
104 // by the audio CPU usage meter. | |
105 double delay; | |
106 | |
22297 | 107 float begin_skip; ///< start time of the current skip while on edlout mode |
108 // audio is muted if either EDL or user activates mute | |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
109 short edl_muted; ///< Stores whether EDL is currently in muted mode. |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
110 short user_muted; ///< Stores whether user wanted muted mode. |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
111 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
112 int global_sub_size; // this encompasses all subtitle sources |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
113 int global_sub_pos; // this encompasses all subtitle sources |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
114 int set_of_sub_pos; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
115 int set_of_sub_size; |
31612
7fc1f051a19f
Change global subtitle numbering scheme so that demuxers can "asynchronously"
reimar
parents:
31607
diff
changeset
|
116 int sub_counts[SUB_SOURCES]; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26877
diff
changeset
|
117 #ifdef CONFIG_ASS |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
118 // set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i] |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
119 // parsed by libass or NULL if format unsupported |
31792
55dacfca4a43
Rename libass types to match upstream libass >= 0.9.7
greg
parents:
31612
diff
changeset
|
120 ASS_Track* set_of_ass_tracks[MAX_SUBTITLE_FILES]; |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
121 #endif |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
122 sub_data* set_of_subtitles[MAX_SUBTITLE_FILES]; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
123 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
124 int file_format; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
125 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
126 #ifdef CONFIG_DVBIN |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
127 int last_dvb_step; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
128 int dvbin_reopen; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
129 #endif |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
130 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
131 int was_paused; |
25824 | 132 |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26877
diff
changeset
|
133 #ifdef CONFIG_DVDNAV |
31396
921a7fb81ebc
Fix type: struct mp_image_s no longer exists, it is now
reimar
parents:
30518
diff
changeset
|
134 struct mp_image *nav_smpi; ///< last decoded dvdnav video image |
25824 | 135 unsigned char *nav_buffer; ///< last read dvdnav video frame |
136 unsigned char *nav_start; ///< pointer to last read video buffer | |
137 int nav_in_size; ///< last read size | |
138 #endif | |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
139 } MPContext; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
140 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
141 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
142 // Most of these should not be globals |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
143 extern int abs_seek_pos; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
144 extern float rel_seek_secs; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
145 extern FILE *edl_fd; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
146 extern int file_filter; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
147 // These appear in options list |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
148 extern float playback_speed; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
149 extern int fixed_vo; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
150 extern int forced_subs_only; |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
151 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
152 |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
153 int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data); |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
154 void uninit_player(unsigned int mask); |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
155 void reinit_audio_chain(void); |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
156 void init_vo_spudec(void); |
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
157 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio, |
25913 | 158 const ao_functions_t *audio_out); |
30518
654cad7ea876
Rename exit_reason_t enum to exit_reason and do not typedef it.
diego
parents:
30516
diff
changeset
|
159 void exit_player(enum exit_reason how); |
654cad7ea876
Rename exit_reason_t enum to exit_reason and do not typedef it.
diego
parents:
30516
diff
changeset
|
160 void exit_player_with_rc(enum exit_reason how, int rc); |
25264
42aa06653705
When auto loading subs, log warning instead of error for load failure.
ulion
parents:
25219
diff
changeset
|
161 void add_subtitles(char *filename, float fps, int noerr); |
22280
a5e5b0c45c03
Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff
changeset
|
162 int reinit_video_chain(void); |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
25264
diff
changeset
|
163 |
26029 | 164 #endif /* MPLAYER_MP_CORE_H */ |