annotate mp_core.h @ 25824:eb338d06c638

Add support for dvdnav still frames playback. Based on various patches from Otvos Attila and MPlayer'ized by me. N.B. Always use -vc ffmpeg12 with dvdnav://
author ben
date Sat, 26 Jan 2008 11:51:34 +0000
parents 6ac1ece1f9fe
children 9d4121fa508a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25264
diff changeset
1 #ifndef MP_CORE_H
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25264
diff changeset
2 #define MP_CORE_H
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25264
diff changeset
3
22280
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
4 // 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
5
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
6 #define INITED_VO 1
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
7 #define INITED_AO 2
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
8 #define INITED_GUI 4
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
9 #define INITED_GETCH2 8
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
10 #define INITED_SPUDEC 32
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
11 #define INITED_STREAM 64
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
12 #define INITED_INPUT 128
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
13 #define INITED_VOBSUB 256
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
14 #define INITED_DEMUXER 512
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
15 #define INITED_ACODEC 1024
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
16 #define INITED_VCODEC 2048
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
17 #define INITED_ALL 0xFFFF
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
18
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
19
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
20 #define SUB_SOURCE_SUBS 0
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
21 #define SUB_SOURCE_VOBSUB 1
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
22 #define SUB_SOURCE_DEMUX 2
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
23 #define SUB_SOURCES 3
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
24
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
25
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
26 #define PT_NEXT_ENTRY 1
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
27 #define PT_PREV_ENTRY -1
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
28 #define PT_NEXT_SRC 2
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
29 #define PT_PREV_SRC -2
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
30 #define PT_UP_NEXT 3
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
31 #define PT_UP_PREV -3
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
32
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
33
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
34 #define OSD_MSG_TV_CHANNEL 0
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
35 #define OSD_MSG_TEXT 1
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
36 #define OSD_MSG_SUB_DELAY 2
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
37 #define OSD_MSG_SPEED 3
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
38 #define OSD_MSG_OSD_STATUS 4
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
39 #define OSD_MSG_BAR 5
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
40 #define OSD_MSG_PAUSE 6
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
41 #define OSD_MSG_RADIO_CHANNEL 7
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
42 /// Base id for messages generated from the commmand to property bridge.
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
43 #define OSD_MSG_PROPERTY 0x100
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
44
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
45 #define MAX_OSD_LEVEL 3
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
46 #define MAX_TERM_OSD_LEVEL 1
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
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
49 typedef struct MPContext {
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
50 int osd_show_percentage;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
51 int osd_function;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
52 ao_functions_t *audio_out;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
53 play_tree_t *playtree;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
54 play_tree_iter_t *playtree_iter;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
55 int eof;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
56 int play_tree_step;
23726
11abe5f3dcaa Move loop_times into mpctx.
albeu
parents: 22488
diff changeset
57 int loop_times;
22280
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
58
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
59 stream_t *stream;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
60 demuxer_t *demuxer;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
61 sh_audio_t *sh_audio;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
62 sh_video_t *sh_video;
22297
3340e52ad814 Move some related variables together & add a comment
uau
parents: 22288
diff changeset
63 demux_stream_t *d_audio;
22280
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
64 demux_stream_t *d_video;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
65 demux_stream_t *d_sub;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
66 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
67 const vo_functions_t *video_out;
22288
da8ba4c0fc57 Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents: 22280
diff changeset
68 // 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
69 // 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
70 // struct.
da8ba4c0fc57 Cleanup, move "global" state from the frame_time_remaining mainloop
uau
parents: 22280
diff changeset
71 int num_buffered_frames;
22280
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
72
22488
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
73 // AV sync: the next frame should be shown when the audio out has this
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
74 // much (in seconds) buffered data left. Increased when more data is
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
75 // written to the ao, decreased when moving to the next frame.
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
76 // In the audio-only case used as a timer since the last seek
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
77 // by the audio CPU usage meter.
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
78 double delay;
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22297
diff changeset
79
22297
3340e52ad814 Move some related variables together & add a comment
uau
parents: 22288
diff changeset
80 float begin_skip; ///< start time of the current skip while on edlout mode
3340e52ad814 Move some related variables together & add a comment
uau
parents: 22288
diff changeset
81 // 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
82 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
83 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
84
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
85 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
86 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
87 int set_of_sub_pos;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
88 int set_of_sub_size;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
89 int global_sub_indices[SUB_SOURCES];
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
90 #ifdef USE_ASS
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
91 // 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
92 // parsed by libass or NULL if format unsupported
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
93 ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
94 #endif
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
95 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
96
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
97 int file_format;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
98
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
99 #ifdef HAS_DVBIN_SUPPORT
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
100 int last_dvb_step;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
101 int dvbin_reopen;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
102 #endif
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
103
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
104 int was_paused;
25824
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
105
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
106 #ifdef USE_DVDNAV
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
107 mp_image_t *nav_smpi; ///< last decoded dvdnav video image
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
108 unsigned char *nav_buffer; ///< last read dvdnav video frame
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
109 unsigned char *nav_start; ///< pointer to last read video buffer
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
110 int nav_in_size; ///< last read size
eb338d06c638 Add support for dvdnav still frames playback.
ben
parents: 25553
diff changeset
111 #endif
22280
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
112 } MPContext;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
113
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
114
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
115 // 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
116 extern int abs_seek_pos;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
117 extern float rel_seek_secs;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
118 extern FILE *edl_fd;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
119 extern int file_filter;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
120 // These appear in options list
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
121 extern float playback_speed;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
122 extern int osd_duration;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
123 extern int term_osd;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
124 extern int fixed_vo;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
125 extern int forced_subs_only;
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
126
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
127
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
128 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
129 void uninit_player(unsigned int mask);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
130 void reinit_audio_chain(void);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
131 void init_vo_spudec(void);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
132 void set_osd_bar(int type,const char* name,double min,double max,double val);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
133 void set_osd_msg(int id, int level, int time, const char* fmt, ...);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
134 double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
135 ao_functions_t *audio_out);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
136 void exit_player_with_rc(const char* how, int rc);
a5e5b0c45c03 Split command/property handling from mplayer.c to a new file command.c.
uau
parents:
diff changeset
137 void rm_osd_msg(int id);
25264
42aa06653705 When auto loading subs, log warning instead of error for load failure.
ulion
parents: 25219
diff changeset
138 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
139 int reinit_video_chain(void);
25553
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25264
diff changeset
140
6ac1ece1f9fe Add multiple inclusion guards to all header files that lack them.
diego
parents: 25264
diff changeset
141 #endif /* MP_CORE_H */